/**
 * =====================================================
 * MCQ Learning Hub - Custom Styles
 * =====================================================
 * Clean, educational-themed design
 */

/* ===== CSS Variables ===== */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary: #64748b;
    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #06b6d4;
    --info-light: #cffafe;
    --light: #f8fafc;
    --dark: #1e293b;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
}

/* ===== Base Styles ===== */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #f0fdf4 100%);
    min-height: 100vh;
    color: var(--gray-800);
    line-height: 1.6;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

/* ===== Navbar ===== */
.navbar {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    padding: 0.75rem 0;
}

.navbar-brand {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary) !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand i {
    font-size: 1.75rem;
}

.nav-link {
    font-weight: 500;
    color: var(--gray-600) !important;
    padding: 0.5rem 1rem !important;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary) !important;
    background: var(--gray-100);
}

/* ===== Cards ===== */
.card {
    background: white;
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

.card-body {
    padding: 1.5rem;
}

/* ===== Mode Cards ===== */
.mode-card {
    text-align: center;
    padding: 2rem 1.5rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.mode-card:hover {
    border-color: var(--primary);
}

.mode-card .icon-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 2rem;
}

.mode-card.learn .icon-wrapper {
    background: var(--info-light);
    color: var(--info);
}

.mode-card.mock .icon-wrapper {
    background: var(--warning-light);
    color: var(--warning);
}

.mode-card.grand .icon-wrapper {
    background: var(--success-light);
    color: var(--success);
}

.mode-card h4 {
    margin-bottom: 0.5rem;
}

.mode-card p {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* ===== Buttons ===== */
.btn {
    font-weight: 500;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-outline-primary {
    border: 2px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
}

.btn-outline-secondary {
    border: 2px solid var(--gray-300);
    color: var(--gray-600);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1.1rem;
}

/* ===== Question Styles ===== */
.question-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.question-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.question-number {
    font-weight: 700;
    font-size: 1.1rem;
}

.question-set-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.8rem;
}

.question-body {
    padding: 1.5rem;
}

.question-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--dark);
    margin-bottom: 1.25rem;
    line-height: 1.7;
}

/* ===== Options ===== */
.options-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.option-item {
    display: flex;
    align-items: flex-start;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-item:hover {
    border-color: var(--primary);
    background: var(--gray-50);
}

.option-item.selected {
    border-color: var(--primary);
    background: #eff6ff;
}

.option-item.correct {
    border-color: var(--success);
    background: var(--success-light);
}

.option-item.wrong {
    border-color: var(--danger);
    background: var(--danger-light);
}

.option-label {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 1rem;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.option-item.selected .option-label {
    background: var(--primary);
    color: white;
}

.option-item.correct .option-label {
    background: var(--success);
    color: white;
}

.option-item.wrong .option-label {
    background: var(--danger);
    color: white;
}

.option-text {
    flex: 1;
    padding-top: 0.25rem;
}

/* ===== Answer Display (Learn Mode) ===== */
.correct-answer-display {
    background: var(--success-light);
    border: 1px solid var(--success);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.correct-answer-display i {
    color: var(--success);
}

.correct-answer-display span {
    font-weight: 600;
    color: var(--success);
}

/* ===== Timer ===== */
.timer-display {
    position: fixed;
    top: 80px;
    right: 20px;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    text-align: center;
}

.timer-display.warning {
    background: var(--warning-light);
    animation: pulse 1s infinite;
}

.timer-display.danger {
    background: var(--danger-light);
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.timer-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.timer-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark);
    font-family: 'Roboto Mono', monospace;
}

.timer-display.warning .timer-value {
    color: var(--warning);
}

.timer-display.danger .timer-value {
    color: var(--danger);
}

/* ===== Progress Bar ===== */
.progress-wrapper {
    margin-bottom: 1.5rem;
}

.progress {
    height: 8px;
    border-radius: 4px;
    background: var(--gray-200);
}

.progress-bar {
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 0.5rem;
}

/* ===== Results Page ===== */
.result-card {
    text-align: center;
    padding: 3rem 2rem;
}

.result-icon {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 3rem;
}

.result-icon.pass {
    background: var(--success-light);
    color: var(--success);
}

.result-icon.fail {
    background: var(--danger-light);
    color: var(--danger);
}

.result-score {
    font-size: 4rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
    min-width: 100px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.stat-value.correct { color: var(--success); }
.stat-value.wrong { color: var(--danger); }
.stat-value.total { color: var(--primary); }

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-500);
    text-transform: uppercase;
}

/* ===== Table Styles ===== */
.table {
    margin-bottom: 0;
}

.table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-200);
    padding: 1rem;
}

.table td {
    padding: 1rem;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background: var(--gray-50);
}

/* ===== Forms ===== */
.form-control,
.form-select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-label {
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

/* ===== File Upload ===== */
.upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--gray-50);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: #eff6ff;
}

.upload-area i {
    font-size: 3rem;
    color: var(--gray-400);
    margin-bottom: 1rem;
}

.upload-area h5 {
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.upload-area p {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-bottom: 0;
}

/* ===== Admin Sidebar ===== */
.admin-sidebar {
    background: white;
    min-height: calc(100vh - 56px);
    box-shadow: var(--shadow);
    padding: 1rem 0;
}

.admin-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem !important;
    color: var(--gray-600) !important;
    border-left: 3px solid transparent;
}

.admin-nav .nav-link:hover,
.admin-nav .nav-link.active {
    background: var(--gray-50);
    color: var(--primary) !important;
    border-left-color: var(--primary);
}

.admin-nav .nav-link i {
    width: 20px;
    text-align: center;
}

/* ===== Pagination ===== */
.pagination {
    gap: 0.25rem;
}

.page-link {
    border: none;
    border-radius: var(--radius);
    padding: 0.5rem 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
}

.page-link:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.page-item.active .page-link {
    background: var(--primary);
    color: white;
}

/* ===== Badges ===== */
.badge {
    font-weight: 500;
    padding: 0.35rem 0.75rem;
    border-radius: 2rem;
}

.badge-set {
    background: var(--info-light);
    color: var(--info);
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state i {
    font-size: 4rem;
    color: var(--gray-300);
    margin-bottom: 1rem;
}

.empty-state h4 {
    color: var(--gray-600);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--gray-500);
}

/* ===== Footer ===== */
.footer {
    background: white;
    padding: 1.5rem 0;
    margin-top: 3rem;
    text-align: center;
    color: var(--gray-500);
    font-size: 0.9rem;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    .mode-card {
        padding: 1.5rem 1rem;
    }
    
    .mode-card .icon-wrapper {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .timer-display {
        position: static;
        margin-bottom: 1rem;
    }
    
    .result-score {
        font-size: 3rem;
    }
    
    .result-stats {
        gap: 1rem;
    }
    
    .question-body {
        padding: 1rem;
    }
    
    .option-item {
        padding: 0.875rem 1rem;
    }
}

/* ===== Navigation Buttons ===== */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
}

.nav-buttons .btn {
    min-width: 120px;
}

/* ===== Question Navigator ===== */
.question-navigator {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.q-nav-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    border: 2px solid var(--gray-200);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.q-nav-btn:hover {
    border-color: var(--primary);
}

.q-nav-btn.answered {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.q-nav-btn.current {
    border-color: var(--warning);
    box-shadow: 0 0 0 2px var(--warning);
}

/* ===== Loading Spinner ===== */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ===== View Toggle ===== */
.view-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.view-toggle .btn {
    flex: 1;
}

.view-toggle .btn.active {
    background: var(--primary);
    color: white;
}
