/* ============ 全局樣式 ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 900px;
    width: 100%;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.language-selector {
    display: flex;
    gap: 8px;
}

.lang-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.lang-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

.lang-btn.active {
    background: rgba(255,255,255,0.4);
    border-color: white;
}

/* ============ 頁面容器 ============ */
.page {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============ 卡片樣式 ============ */
.form-box, .welcome-box, .result-box {
    background: white;
    border-radius: 10px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.welcome-box h2, .form-box h2, .result-box h2 {
    color: #333;
    margin-bottom: 20px;
}

.welcome-box p {
    color: #666;
    margin-bottom: 30px;
}

/* ============ 表單樣式 ============ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* ============ 按鈕樣式 ============ */
.button-group, .form-group {
    margin-bottom: 20px;
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: #48bb78;
    color: white;
    width: 100%;
    margin-top: 10px;
}

.btn-success:hover {
    background: #38a169;
}

.btn-danger {
    background: #f56565;
    color: white;
}

.btn-danger:hover {
    background: #e53e3e;
}

.btn-secondary {
    background: #a0aec0;
    color: white;
    margin-top: 10px;
    width: 100%;
}

.btn-secondary:hover {
    background: #718096;
}

/* ============ 考試頁 ============ */
.exam-container {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.exam-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 20px;
}

.exam-header h2 {
    color: #333;
    margin: 0;
}

.timer {
    font-size: 1.4em;
    color: #ffffff;
    font-weight: bold;
    background: #f56565;
    padding: 10px 20px;
    border-radius: 30px;
    position: fixed;
    top: 20px;
    right: 20px;
    box-shadow: 0 4px 15px rgba(245, 101, 101, 0.4);
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 8px;
}

.question-block {
    margin-bottom: 30px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.question-number {
    color: #667eea;
    font-weight: bold;
    margin-bottom: 0;
}

.question-type {
    background: #e6f2ff;
    color: #667eea;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
}

.question-text {
    font-size: 1.1em;
    color: #333;
    margin-bottom: 15px;
    font-weight: 500;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option {
    display: flex;
    align-items: center;
    padding: 12px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.option:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.option input[type="radio"],
.option input[type="checkbox"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.option label {
    flex: 1;
    cursor: pointer;
    margin: 0;
}

.option.selected {
    background: #e6f2ff;
    border-color: #667eea;
}

.exam-footer {
    margin-top: 30px;
    text-align: center;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

/* ============ 結果頁 ============ */
.result-box {
    text-align: center;
}

.score-display {
    display: flex;
    justify-content: center;
    align-items: baseline;
    margin: 30px 0;
}

.score-number {
    font-size: 4em;
    font-weight: bold;
    color: #667eea;
}

.score-label {
    font-size: 1.5em;
    color: #666;
    margin-left: 10px;
}

#result-message {
    font-size: 1.2em;
    color: #333;
    margin: 20px 0 30px 0;
}

/* ============ 消息提示 ============ */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 5px;
    color: white;
    font-weight: 600;
    max-width: 300px;
    animation: slideIn 0.3s ease-out;
    z-index: 1000;
}

.message.hidden {
    display: none;
}

.message.success {
    background: #48bb78;
}

.message.error {
    background: #f56565;
}

.message.info {
    background: #4299e1;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============ 響應式設計 ============ */
@media (max-width: 600px) {
    header h1 {
        font-size: 1.8em;
    }

    .form-box, .welcome-box, .result-box {
        padding: 20px;
    }

    .button-group {
        flex-direction: column;
    }

    .btn-primary {
        width: 100%;
    }

    .exam-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .score-number {
        font-size: 3em;
    }
}
/* ============ 考試信息頁面 ============ */
.exam-info-display {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 5px solid #667eea;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 600;
    color: #333;
    flex: 1;
}

.info-value {
    color: #667eea;
    font-size: 1.1em;
    font-weight: 500;
    text-align: right;
    flex: 1;
}

.info-countdown {
    color: #ff6b6b;
    font-size: 1.2em;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ============ 答案詳情樣式 ============ */
#answer-details {
    margin-top: 30px;
    border-top: 2px solid #ddd;
    padding-top: 20px;
}

#answer-details h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.2em;
}

#answer-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.answer-item {
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    background-color: #f9f9f9;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

.answer-item.answer-correct {
    border-left: 5px solid #4caf50;
    background-color: #f1f8f6;
    border-color: #c8e6c9;
}

.answer-item.answer-incorrect {
    border-left: 5px solid #f44336;
    background-color: #fef5f5;
    border-color: #ffcdd2;
}

.answer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.answer-status {
    font-weight: bold;
    font-size: 1.1em;
}

.answer-type {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
}

.answer-item.answer-correct .answer-type {
    background-color: #c8e6c9;
    color: #2e7d32;
}

.answer-item.answer-incorrect .answer-type {
    background-color: #ffcdd2;
    color: #c62828;
}

.answer-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.question-content {
    padding: 12px;
    background-color: #fff;
    border-radius: 4px;
    border-left: 3px solid #2196f3;
}

.question-content strong {
    color: #1976d2;
}

.user-answer {
    padding: 12px;
    background-color: #fff;
    border-left: 3px solid #ff9800;
    border-radius: 4px;
}

.user-answer strong {
    color: #e65100;
}

.correct-answer {
    padding: 12px;
    background-color: #fff;
    border-left: 3px solid #4caf50;
    border-radius: 4px;
}

.correct-answer strong {
    color: #2e7d32;
}
