/* 測驗頁面樣式 */
body { 
    background-color: #f0f2f5; 
    overflow-y: auto; 
    min-height: 100vh; 
    font-family: 'Noto Sans TC', sans-serif; 
}

.navbar { 
    height: 50px; 
    background: white !important; 
    position: sticky; 
    top: 0; 
    z-index: 1000; 
}

.navbar.exam-mode {
    border-top: 4px solid #0d6efd;
}

.navbar.practice-mode {
    border-top: 4px solid #198754;
}

.main-container { 
    padding: 8px 0; 
}

.q-card { 
    background: white; 
    border-radius: 12px; 
    box-shadow: 0 5px 20px rgba(0,0,0,0.08); 
    width: 100%; 
    min-height: auto; 
    display: none; 
    flex-direction: column; 
    margin: 0 auto 20px auto; 
    overflow: hidden; 
}

.q-card.active { 
    display: flex; 
}

.q-header { 
    padding: 12px 20px; 
    border-bottom: 1px solid #eee; 
    background: #fff; 
}

.q-scroll-text { 
    min-height: auto; 
    padding: 30px 20px; 
    background: #e8f0e8; 
    border-bottom: 1px solid #d0e0d0; 
    font-size: 1.1rem; 
    font-weight: 600; 
    line-height: 1.5; 
    color: #1e293b; 
}

.q-scroll-options { 
    padding: 12px 20px; 
    background: #fff; 
    min-height: auto; 
}

.q-scroll-analysis { 
    padding: 25px 20px; 
    background: #fdfdfd; 
    border-top: 4px solid #198754; 
    display: none; 
}

.q-footer { 
    height: 55px; 
    padding: 0 20px; 
    border-top: 1px solid #eee; 
    background: #fff; 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
}

.opt-label { 
    display: block; 
    padding: 10px 15px; 
    margin-bottom: 8px; 
    border: 2px solid #f0f7f4; 
    border-radius: 10px; 
    cursor: pointer; 
    background: #fff; 
    transition: 0.2s; 
    font-size: 1rem; 
}

.opt-input { 
    display: none; 
}

.opt-input:checked + .opt-label.exam-mode { 
    border-color: #0d6efd; 
    background-color: #f0f7ff; 
    border-width: 3px; 
    font-weight: 700; 
}

.opt-input:checked + .opt-label.practice-mode { 
    border-color: #198754; 
    background-color: #f0fdf4; 
    border-width: 3px; 
    font-weight: 700; 
}

.opt-correct { 
    border-color: #198754 !important; 
    background-color: #f0fdf4 !important; 
    color: #198754 !important; 
    font-weight: bold; 
}

.opt-wrong { 
    border: 3px solid #dc3545 !important; 
    background-color: #ffe0e0 !important; 
    color: #dc3545 !important; 
    font-weight: bold; 
    position: relative;
}

.opt-wrong::before {
    content: '✗';
    position: absolute;
    right: 15px;
    font-size: 1.2rem;
    color: #dc3545;
}

.q-text { 
    font-size: 1.2rem; 
    font-weight: 600; 
    margin-bottom: 30px; 
    line-height: 1.5; 
    color: #1a1a1a; 
}

.opt-input:checked + .opt-label { 
    background: #e6f2ed; 
    border-color: #2d6a4f; 
    font-weight: 700; 
}

.side-panel { 
    background: white; 
    border-radius: 20px; 
    padding: 25px; 
    border: 1px solid #e0eee0; 
    box-shadow: 0 5px 20px rgba(0,0,0,0.05); 
}

.nav-grid-vertical { 
    display: grid; 
    grid-template-columns: repeat(4, 1fr); 
    gap: 10px; 
}

.nav-item { 
    width: 100%; 
    aspect-ratio: 1; 
    border-radius: 10px; 
    border: 1px solid #dee2e6; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-weight: 700; 
    cursor: pointer; 
    background: #fff; 
    color: #adb5bd; 
    transition: 0.3s; 
    position: relative; 
}

.nav-item.current { 
    border: 3px solid #1b4332 !important; 
    color: #1b4332 !important; 
    transform: scale(1.1); 
}

.nav-item.answered { 
    background-color: #2d6a4f !important; 
    color: white !important; 
    border-color: #2d6a4f !important; 
}

/* 新增：標記狀態樣式 */
.nav-item.flagged {
    border-color: #ffc107 !important;
    background-color: #fff9e6;
}
.nav-item.flagged::after {
    content: '🚩';
    position: absolute;
    top: -8px;
    right: -5px;
    font-size: 10px;
}
.quiz-actions .btn {
    border-radius: 50px;
    padding: 5px 15px;
    font-size: 0.85rem;
}

/* ========== 手機版 RWD 優化 ========== */
@media (max-width: 768px) {
    /* 導航列 */
    .navbar {
        height: auto;
        padding: 8px 0;
    }
    
    .navbar .container-fluid {
        padding: 0 15px !important;
        flex-wrap: wrap;
    }
    
    .navbar-brand {
        font-size: 0.95rem !important;
    }
    
    .navbar .btn {
        font-size: 0.8rem;
        padding: 4px 12px;
    }
    
    /* 主容器 */
    .main-container {
        padding: 8px 10px !important;
    }
    
    /* 題目卡片 */
    .q-card {
        border-radius: 10px;
        margin-bottom: 15px;
    }
    
    /* 題目標題 */
    .q-header {
        padding: 12px 15px;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .q-header .h4 {
        font-size: 1.1rem !important;
    }
    
    .q-header .btn {
        font-size: 0.75rem;
        padding: 4px 10px;
    }
    
    /* 題目文字 */
    .q-scroll-text {
        padding: 20px 15px;
        font-size: 1rem;
        line-height: 1.6;
    }
    
    /* 選項區域 */
    .q-scroll-options {
        padding: 15px;
    }
    
    .opt-label {
        padding: 12px;
        margin-bottom: 10px;
        font-size: 0.95rem;
        line-height: 1.5;
    }
    
    .opt-label b {
        display: inline-block;
        min-width: 25px;
    }
    
    /* 解析區域 */
    .q-scroll-analysis {
        padding: 20px 15px;
    }
    
    .q-scroll-analysis h6 {
        font-size: 0.95rem;
    }
    
    .q-scroll-analysis div {
        font-size: 0.9rem !important;
    }
    
    /* 底部按鈕區 */
    .q-footer {
        height: auto;
        padding: 12px 15px;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .q-footer .btn {
        font-size: 0.9rem;
        padding: 8px 20px;
    }
    
    .q-footer span {
        font-size: 0.85rem;
        width: 100%;
        text-align: center;
        order: -1;
    }
    
    /* 側邊導航面板 */
    .side-panel {
        padding: 15px;
        margin-top: 15px;
    }
    
    .nav-grid-vertical {
        grid-template-columns: repeat(5, 1fr);
        gap: 8px;
    }
    
    .nav-item {
        font-size: 0.9rem;
    }
}

/* 小手機優化 (iPhone SE 等) */
@media (max-width: 375px) {
    .navbar-brand {
        font-size: 0.85rem !important;
    }
    
    .q-header .h4 {
        font-size: 1rem !important;
    }
    
    .q-header .btn {
        font-size: 0.7rem;
        padding: 3px 8px;
    }
    
    .q-scroll-text {
        font-size: 0.95rem;
        padding: 15px;
    }
    
    .opt-label {
        font-size: 0.9rem;
        padding: 10px;
    }
    
    .q-footer .btn {
        font-size: 0.85rem;
        padding: 6px 15px;
    }
    
    .nav-grid-vertical {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
}