/* =============================================
   QPass AI - Light Theme Design System
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --primary-light: #6366f1;
    --secondary: #0ea5e9;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    /* Light Theme */
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --border: #e2e8f0;
    --border-focus: #4f46e5;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --input-bg: #f8fafc;
    --table-head-bg: #f1f5f9;
    --table-hover: #f8fafc;
    --badge-default-bg: #f1f5f9;
    --badge-default-color: #475569;

    --gradient-primary: linear-gradient(135deg, #4f46e5 0%, #0ea5e9 100%);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-glow: 0 0 0 3px rgba(79, 70, 229, 0.15);
    --radius: 14px;
    --radius-sm: 10px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    margin: 0;
}

/* ---- NAVBAR ---- */
.navbar {
    background: #ffffff !important;
    border-bottom: 1px solid var(--border);
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.25rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 7px 14px !important;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary) !important;
    background: rgba(79, 70, 229, 0.08);
}

/* ---- CARDS ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    color: var(--text-primary);
    transition: var(--transition);
}

.card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.card-header {
    background: var(--table-head-bg) !important;
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
    font-weight: 600;
    color: var(--text-primary);
    border-radius: var(--radius) var(--radius) 0 0 !important;
}

.card-body {
    padding: 20px;
}

/* ---- STAT CARDS ---- */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-card);
}

.stat-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 14px;
}

.stat-icon.primary {
    background: rgba(79, 70, 229, 0.1);
}

.stat-icon.success {
    background: rgba(16, 185, 129, 0.1);
}

.stat-icon.warning {
    background: rgba(245, 158, 11, 0.1);
}

.stat-icon.info {
    background: rgba(14, 165, 233, 0.1);
}

.stat-icon.danger {
    background: rgba(239, 68, 68, 0.1);
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.stat-number.gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
}

/* ---- FORMS ---- */
.form-control,
.form-select {
    background: var(--input-bg);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
    background: #fff;
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-label {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.82rem;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* ---- BUTTONS ---- */
.btn {
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 9px 18px;
    font-size: 0.88rem;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: white !important;
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    color: white !important;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    color: white !important;
}

.btn-outline-secondary {
    border: 1px solid var(--border) !important;
    color: var(--text-secondary) !important;
    background: transparent !important;
}

.btn-outline-secondary:hover {
    background: var(--table-head-bg) !important;
    color: var(--text-primary) !important;
}

.btn-outline-light {
    border: 1px solid var(--border) !important;
    color: var(--text-secondary) !important;
    background: transparent !important;
}

.btn-outline-light:hover {
    background: var(--table-head-bg) !important;
    color: var(--text-primary) !important;
}

.btn-lg {
    padding: 12px 28px !important;
    font-size: 0.95rem !important;
}

/* ---- TABLES ---- */
.table {
    color: var(--text-primary);
    border-color: var(--border);
}

.table thead th {
    background: var(--table-head-bg);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-color: var(--border);
    padding: 12px 16px;
}

.table tbody tr {
    border-color: var(--border);
    transition: var(--transition);
}

.table tbody tr:hover {
    background: var(--table-hover);
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-color: var(--border);
}

/* ---- BADGES ---- */
.badge {
    font-weight: 600;
    font-size: 0.72rem;
    padding: 4px 9px;
    border-radius: 6px;
}

.badge-primary {
    background: rgba(79, 70, 229, 0.12);
    color: var(--primary);
}

.badge-success {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.badge-secondary {
    background: rgba(100, 116, 139, 0.12);
    color: #475569;
}

/* ---- ALERTS ---- */
.alert {
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.alert-info {
    background: rgba(14, 165, 233, 0.1);
    color: #0369a1;
    border-left: 3px solid var(--secondary);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border-left: 3px solid var(--danger);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border-left: 3px solid var(--success);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
    border-left: 3px solid var(--warning);
}

/* ---- HERO SECTION ---- */
.hero-section {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f4fd 100%);
    padding: 48px 0 36px;
    border-bottom: 1px solid var(--border);
}

/* ---- AI BADGE ---- */
.ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(79, 70, 229, 0.1);
    border: 1px solid rgba(79, 70, 229, 0.2);
    color: var(--primary);
    padding: 5px 12px;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 14px;
}

/* ---- PROGRESS BARS ---- */
.progress {
    background: var(--border);
    border-radius: 50px;
    height: 8px;
}

.progress-bar {
    background: var(--gradient-primary);
    border-radius: 50px;
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ---- LIST GROUP ---- */
.list-group-item {
    background: var(--bg-card) !important;
    border-color: var(--border) !important;
    color: var(--text-primary) !important;
    transition: var(--transition);
}

.list-group-item:hover {
    background: var(--table-hover) !important;
}

hr {
    border-color: var(--border);
    opacity: 1;
}

/* ---- PAPER PREVIEW ---- */
.paper-container {
    background: white !important;
    color: #1a1a1a !important;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}

/* ---- QUESTION ITEM ---- */
.question-item {
    border-radius: var(--radius-sm) !important;
    margin-bottom: 8px;
    border: 1px solid var(--border) !important;
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

.question-text-input {
    background: var(--input-bg) !important;
    color: var(--text-primary) !important;
}

.move-handle {
    cursor: grab;
    color: var(--text-muted) !important;
    font-size: 1.2rem;
}

.move-handle:active {
    cursor: grabbing;
}

/* ---- UPLOAD AREA ---- */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg);
    display: block;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.04);
}

.upload-area .upload-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
    opacity: 0.4;
}

/* ---- SIDEBAR (User Panel) ---- */
.user-sidebar {
    background: #fff;
    border-right: 1px solid var(--border);
    min-height: 100vh;
    padding: 20px 0;
    width: 230px;
    position: fixed;
    top: 0;
    left: 0;
    box-shadow: var(--shadow-sm);
    z-index: 100;
}

.user-sidebar .sidebar-brand {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
    font-weight: 800;
    font-size: 1.1rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: block;
}

.user-sidebar .nav-link {
    padding: 10px 20px !important;
    border-radius: 0 !important;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    color: var(--text-secondary) !important;
}

.user-sidebar .nav-link:hover {
    background: rgba(79, 70, 229, 0.06) !important;
    color: var(--primary) !important;
}

.user-sidebar .nav-link.active {
    background: rgba(79, 70, 229, 0.1) !important;
    border-right: 3px solid var(--primary);
    color: var(--primary) !important;
    font-weight: 600;
}

.user-content {
    margin-left: 230px;
    padding: 28px;
    min-height: 100vh;
    background: var(--bg);
}

/* ---- SIDEBAR (Admin) - Modern AI Vibe ---- */
.admin-sidebar {
    background: #0f1115;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 100vh;
    padding: 24px 0;
    width: 250px;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.admin-sidebar .sidebar-brand {
    padding: 0 24px 24px;
    margin-bottom: 12px;
    font-weight: 800;
    font-size: 1.25rem;
    background: linear-gradient(135deg, #a78bfa, #6366f1, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.5px;
}

.admin-sidebar .nav {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 0 12px;
    gap: 4px;
}

.admin-sidebar .nav-link {
    padding: 12px 16px !important;
    border-radius: 12px !important;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: #94a3b8 !important;
    transition: all 0.2s ease;
    font-weight: 500;
}

.admin-sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.04) !important;
    color: #f8fafc !important;
    transform: translateX(4px);
}

.admin-sidebar .nav-link.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0) 100%) !important;
    border-left: 3px solid #818cf8;
    color: #818cf8 !important;
    font-weight: 600;
    border-radius: 4px 12px 12px 4px !important;
}

.admin-sidebar .nav-link[href*="logout"] {
    margin-top: auto;
    color: #ef4444 !important;
}

.admin-sidebar .nav-link[href*="logout"]:hover {
    background: rgba(239, 68, 68, 0.1) !important;
}

.admin-content {
    margin-left: 250px;
    padding: 28px;
    min-height: 100vh;
    background: #f8fafc;
}

/* ---- LIMIT BADGE ---- */
.limit-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.limit-ok {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.limit-warn {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.limit-exceeded {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

/* ---- MODAL OVERLAY ---- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-overlay.show {
    display: flex;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    width: 480px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
}

/* ---- ANIMATIONS ---- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.4s ease forwards;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {

    .admin-sidebar,
    .user-sidebar {
        display: none;
    }

    .admin-content,
    .user-content {
        margin-left: 0;
        padding: 16px;
    }

    .stat-number {
        font-size: 1.6rem;
    }

    .admin-sidebar .badge {
    padding: 4px 6px;
    font-size: 0.65rem;
    font-weight: 700;
}
}

@media (max-width: 900px) {
    .user-sidebar, .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        z-index: 1050;
    }
    .user-sidebar.show, .admin-sidebar.show {
        transform: translateX(0);
    }
    .user-content {
        margin-left: 0 !important;
        padding: 15px !important;
        width: 100% !important;
    }
}