/* =========================================================================
   365 QUIZ PORTAL - STYLING CHUYÊN NGHIỆP TỐI ƯU MOBILE FIRST (FULL CHUẨN)
   File: public_html/quiz/css/quiz.css
   ========================================================================= */

*, *::before, *::after { 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent; /* Bỏ vệt xanh khó chịu khi chạm trên điện thoại */
}

body {
    background-color: #f1f5f9;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #0f172a;
    font-size: 0.9rem;
    font-feature-settings: "tnum";
    margin: 0;
    padding: 0;
    -webkit-text-size-adjust: 100%;
}

/* 1. MÀN HÌNH ĐĂNG NHẬP */
.login-container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f2b48 0%, #061524 100%);
    padding: 16px;
}

.login-card {
    background: white;
    padding: 35px 24px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.35);
    width: 100%;
    max-width: 420px;
}

.quiz-badge {
    display: inline-block;
    background-color: #1e3a5f;
    color: #38bdf8;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 1px;
}

/* 2. BỐ CỤC CHÍNH */
.quiz-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
}

.quiz-topbar {
    background: #1e3a5f;
    color: white;
    height: 56px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    z-index: 1000;
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: #ffffff;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.admin-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 20px;
}

.admin-nav .nav-btn {
    background: transparent;
    border: none;
    color: #cbd5e1;
    font-weight: 700;
    font-size: 0.84rem;
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.admin-nav .nav-btn:hover,
.admin-nav .nav-btn.active {
    background-color: #0f2b48;
    color: #ffffff;
}

.user-info-box {
    background: rgba(255, 255, 255, 0.12);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.84rem;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.quiz-body {
    flex: 1;
    overflow-y: auto;
    background-color: #f8fafc;
    -webkit-overflow-scrolling: touch;
}

.quiz-view {
    display: none;
    min-height: 100%;
}
.quiz-view.active {
    display: block;
}

/* 3. KHUNG PHÒNG THI TỐI ƯU MOBILE TUYỆT ĐỐI */
.quiz-container {
    max-width: 680px;
    margin: 0 auto;
    padding: 14px 14px 80px 14px;
}

.quiz-admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}

.exam-icon-circle {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background-color: #e0f2fe;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
}

/* 👉 THANH ĐẾM NGƯỢC GHIM CHẮC CHẮN TRÊN ĐẦU ĐIỆN THOẠI */
.timer-sticky-bar {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 8px;
    z-index: 100;
    background: #0f2b48;
    color: white;
    padding: 10px 16px;
    border-radius: 14px;
    margin-bottom: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.timer-box {
    background: #dc2626;
    color: white;
    font-size: 1.15rem;
    font-weight: 800;
    padding: 5px 14px;
    border-radius: 10px;
    letter-spacing: 1px;
    font-family: monospace;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.4);
}

/* THẺ CÂU HỎI */
.question-card {
    background: white;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    padding: 18px 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.question-title {
    font-size: 0.96rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 14px;
    line-height: 1.55;
}

/* 👉 Ô CHỌN ĐÁP ÁN TO BẢN - CHẠM LÀ ĂN NGAY (FAT-FINGER FRIENDLY) */
.choice-item {
    display: flex;
    align-items: center;
    min-height: 52px;
    padding: 12px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: all 0.15s ease;
    background-color: #ffffff;
}

.choice-item:active {
    transform: scale(0.985); /* Hiệu ứng nhấn đàn hồi trên điện thoại */
}

/* KHI ĐÃ CHỌN ĐÁP ÁN: ĐỔI MÀU NỔI BẬT */
.choice-item.selected {
    background-color: #eff6ff !important;
    border-color: #2563eb !important;
    box-shadow: 0 2px 8px rgba(37,99,235,0.2) !important;
}

.choice-letter {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #f1f5f9;
    color: #475569;
    font-weight: 800;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
    border: 1px solid #cbd5e1;
    transition: all 0.15s ease;
}

.choice-item.selected .choice-letter {
    background-color: #2563eb;
    color: white;
    border-color: #2563eb;
}

.choice-text {
    font-size: 0.9rem;
    line-height: 1.45;
    color: #1e293b;
    word-break: break-word;
}

/* MODAL KẾT QUẢ THI */
.result-score-circle {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(16,185,129,0.35);
}

.result-score-circle .score-number {
    font-size: 2.3rem;
    font-weight: 800;
    line-height: 1;
}

/* BẢNG XẾP HẠNG ADMIN */
.table-custom {
    margin-bottom: 0;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    width: 100% !important;
}

.table-dark-custom th {
    background-color: #1e3a5f !important;
    color: #ffffff !important;
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 10px 12px !important;
    font-size: 0.81rem !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    border-right: 1px solid rgba(255,255,255,0.15);
    border-bottom: 2px solid #0f2b48 !important;
}

.table-custom td {
    padding: 8px 12px !important;
    font-size: 0.84rem !important;
    vertical-align: middle !important;
    white-space: nowrap;
    border-bottom: 1px solid #e2e8f0;
}

/* TOAST THÔNG BÁO GÓC PHẢI */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.quiz-toast {
    pointer-events: auto;
    min-width: 270px;
    padding: 12px 18px;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    font-size: 0.88rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
}
.quiz-toast.bg-success { background-color: #16a34a !important; }
.quiz-toast.bg-danger  { background-color: #dc2626 !important; }
.quiz-toast.bg-warning { background-color: #d97706 !important; }

/* =========================================================================
   👉 TINH CHỈNH ĐẶC BIỆT KHI XEM TRÊN ĐIỆN THOẠI (SMARTPHONE)
   ========================================================================= */
@media (max-width: 768px) {
    .quiz-topbar { 
        padding: 0 12px; 
    }
    
    .admin-nav { 
        display: none !important; 
    }
    
    .timer-sticky-bar { 
        top: 0 !important;
        border-radius: 0 0 14px 14px !important; 
        margin-left: -14px !important; 
        margin-right: -14px !important; 
        padding: 10px 14px !important;
    }

    .timer-box {
        font-size: 1rem !important;
        padding: 4px 10px !important;
    }

    .question-card {
        padding: 14px 12px !important;
    }

    .choice-item {
        padding: 10px 12px !important;
    }

    #toast-container {
        left: 12px !important;
        right: 12px !important;
        bottom: 16px !important;
    }

    .quiz-toast {
        min-width: 100% !important;
    }
}