/* =====================================================
   OnThi.io.vn — Design System
   Bootstrap 5 + Custom Dark/Light Theme
   ===================================================== */

:root {
    --ot-primary: #6366f1;
    --ot-primary-dark: #4f46e5;
    --ot-primary-light: #818cf8;
    --ot-secondary: #0ea5e9;
    --ot-accent: #f59e0b;
    --ot-success: #10b981;
    --ot-danger: #ef4444;
    --ot-warning: #f59e0b;

    --ot-bg: #f8fafc;
    --ot-bg-card: #ffffff;
    --ot-bg-card-hover: #f1f5f9;
    --ot-text: #1e293b;
    --ot-text-muted: #64748b;
    --ot-border: #e2e8f0;
    --ot-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --ot-shadow-lg: 0 10px 40px rgba(0,0,0,0.1);
    --ot-radius: 12px;
    --ot-radius-sm: 8px;
    --ot-transition: all 0.2s ease;
}

/* Dark Mode */
body.dark, .dark {
    --ot-bg: #0f172a;
    --ot-bg-card: #1e293b;
    --ot-bg-card-hover: #334155;
    --ot-text: #e2e8f0;
    --ot-text-muted: #94a3b8;
    --ot-border: #334155;
    --ot-shadow: 0 1px 3px rgba(0,0,0,0.5);
    --ot-shadow-lg: 0 10px 40px rgba(0,0,0,0.6);
}

body.dark .bg-light { background-color: #1e293b !important; color: #94a3b8 !important; }
body.dark .text-dark { color: #f8fafc !important; }
body.dark .text-muted { color: #94a3b8 !important; }

/* Dark mode overrides for common components */
body.dark .dropdown-menu { background-color: #1e293b; border-color: #334155; }
body.dark .dropdown-item { color: #e2e8f0; }
body.dark .dropdown-item:hover { background-color: #334155; color: var(--ot-primary-light); }
body.dark .dropdown-divider { border-color: #334155; }

body.dark .list-group-item { background-color: #1e293b; color: #e2e8f0; border-color: #334155; }
body.dark .list-group-item-action:hover { background-color: #334155; color: #fff; }

body.dark .accordion-item { background-color: #1e293b; border-color: #334155; }
body.dark .accordion-button { background-color: #1e293b; color: #e2e8f0; }
body.dark .accordion-button:not(.collapsed) { background-color: rgba(99, 102, 241, 0.1); color: var(--ot-primary-light); }
body.dark .accordion-button::after { filter: invert(1) grayscale(1); }

body.dark .form-control, body.dark .form-select { background-color: #0f172a; border-color: #334155; color: #e2e8f0; }
body.dark .form-control::placeholder { color: #94a3b8 !important; opacity: 0.6; }
body.dark .form-control:focus { border-color: var(--ot-primary); background-color: #0f172a; }

body.dark .breadcrumb-item + .breadcrumb-item::before { color: #4b5563; }
body.dark .breadcrumb-item a { color: var(--ot-primary-light); }
body.dark .breadcrumb-item.active { color: #f1f5f9; }

body.dark .table { color: #e2e8f0; border-color: #334155; }
body.dark .table-light { background-color: #334155; color: #fff; border-color: #475569; }
body.dark .table-hover tbody tr:hover { background-color: rgba(255,255,255,0.03); color: #fff; }

body.dark .modal-content { background-color: #1e293b; color: #e2e8f0; border-color: #334155; }
body.dark .modal-header, body.dark .modal-footer { border-color: #334155; }
body.dark .btn-close { filter: invert(1) grayscale(1); }

body.dark .bg-white { background-color: #1e293b !important; }
body.dark hr { border-color: #334155; opacity: 1; }

body.dark .ot-navbar .nav-link { color: #94a3b8; }
body.dark .ot-navbar .nav-link:hover, body.dark .ot-navbar .nav-link.active { color: var(--ot-primary-light); background: rgba(99, 102, 241, 0.15); }

body.dark .page-link { background-color: #1e293b; border-color: #334155; color: var(--ot-primary-light); }
body.dark .page-item.active .page-link { background-color: var(--ot-primary); border-color: var(--ot-primary); color: #fff; }
body.dark .page-item.disabled .page-link { background-color: #0f172a; border-color: #334155; color: #4b5563; }

/* Scrollbar */
body.dark::-webkit-scrollbar { width: 10px; }
body.dark::-webkit-scrollbar-track { background: #0f172a; }
body.dark::-webkit-scrollbar-thumb { background: #334155; border-radius: 5px; }
body.dark::-webkit-scrollbar-thumb:hover { background: #475569; }


/* =====================================================
   Global
   ===================================================== */
* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--ot-bg);
    color: var(--ot-text);
    transition: background 0.3s ease, color 0.3s ease;
    line-height: 1.6;
}

a { color: var(--ot-primary); text-decoration: none; transition: var(--ot-transition); }
a:hover { color: var(--ot-primary-dark); }

::selection { background: var(--ot-primary); color: #fff; }

/* =====================================================
   Navbar
   ===================================================== */
.ot-navbar {
    background: var(--ot-bg-card);
    border-bottom: 1px solid var(--ot-border);
    box-shadow: var(--ot-shadow);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1030;
    backdrop-filter: blur(12px);
}

.ot-navbar .navbar-brand {
    font-weight: 800;
    font-size: 1.4rem;
    background: linear-gradient(135deg, var(--ot-primary), var(--ot-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ot-navbar .nav-link {
    color: var(--ot-text-muted);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--ot-radius-sm);
    transition: var(--ot-transition);
}

.ot-navbar .nav-link:hover,
.ot-navbar .nav-link.active {
    color: var(--ot-primary);
    background: rgba(99, 102, 241, 0.08);
}

/* =====================================================
   Cards
   ===================================================== */
.ot-card {
    background: var(--ot-bg-card);
    border: 1px solid var(--ot-border);
    border-radius: var(--ot-radius);
    box-shadow: var(--ot-shadow);
    overflow: hidden;
    transition: var(--ot-transition);
    position: relative;
}

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

.ot-card .card-img-top {
    height: 180px;
    object-fit: cover;
}

.ot-card .card-body { padding: 1.25rem; }

.ot-card .card-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--ot-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ot-card .card-text {
    color: var(--ot-text-muted);
    font-size: 0.875rem;
}

/* =====================================================
   Exam Card
   ===================================================== */
.exam-card {
    background: var(--ot-bg-card);
    border: 1px solid var(--ot-border);
    border-radius: var(--ot-radius);
    padding: 1.5rem;
    transition: var(--ot-transition);
    position: relative;
    overflow: hidden;
}

.exam-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.exam-card.thpt::before { background: linear-gradient(90deg, var(--ot-primary), var(--ot-primary-light)); }
.exam-card.hsa::before { background: linear-gradient(90deg, var(--ot-success), var(--ot-secondary)); }

.exam-card:hover {
    box-shadow: var(--ot-shadow-lg);
    transform: translateY(-3px);
    border-color: var(--ot-primary);
}

.exam-card .exam-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.exam-card .exam-type-badge.thpt { background: rgba(99,102,241,0.1); color: var(--ot-primary); }
.exam-card .exam-type-badge.hsa { background: rgba(16,185,129,0.1); color: var(--ot-success); }

.exam-card .exam-meta {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
    color: var(--ot-text-muted);
    font-size: 0.875rem;
}

.exam-card .exam-meta i { margin-right: 4px; }

/* =====================================================
   Buttons
   ===================================================== */
.btn-ot-primary {
    background: linear-gradient(135deg, var(--ot-primary), var(--ot-primary-dark));
    color: #fff;
    border: none;
    border-radius: var(--ot-radius-sm);
    padding: 0.625rem 1.5rem;
    font-weight: 600;
    transition: var(--ot-transition);
    box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}

.btn-ot-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99,102,241,0.4);
    color: #fff;
}

.btn-ot-outline {
    border: 2px solid var(--ot-primary);
    color: var(--ot-primary);
    background: transparent;
    border-radius: var(--ot-radius-sm);
    padding: 0.5rem 1.25rem;
    font-weight: 600;
    transition: var(--ot-transition);
}

.btn-ot-outline:hover {
    background: var(--ot-primary);
    color: #fff;
}

/* =====================================================
   Hero / Banner
   ===================================================== */
.ot-hero {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
    color: #fff;
    padding: 3rem 0;
    border-radius: 0;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.ot-hero::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(99,102,241,0.2) 0%, transparent 70%);
    border-radius: 50%;
}

.ot-hero h1 {
    font-weight: 800;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.ot-hero p {
    opacity: 0.85;
    font-size: 1.1rem;
}

/* =====================================================
   Section Headers
   ===================================================== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-weight: 700;
    font-size: 1.5rem;
    position: relative;
    padding-left: 1rem;
}

.section-header h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 4px;
    background: linear-gradient(180deg, var(--ot-primary), var(--ot-secondary));
    border-radius: 4px;
}

/* =====================================================
   Auth Forms
   ===================================================== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
    padding: 2rem;
}

.auth-card {
    background: var(--ot-bg-card);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.auth-card .auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-card .auth-logo h2 {
    font-weight: 800;
    background: linear-gradient(135deg, var(--ot-primary), var(--ot-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-card .form-control {
    padding: 0.75rem 1rem;
    border-radius: var(--ot-radius-sm);
    border: 2px solid var(--ot-border);
    background: var(--ot-bg);
    transition: var(--ot-transition);
}

.auth-card .form-control:focus {
    border-color: var(--ot-primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--ot-border);
    border-radius: var(--ot-radius-sm);
    background: var(--ot-bg);
    color: var(--ot-text);
    font-weight: 600;
    transition: var(--ot-transition);
}

.btn-google:hover {
    background: var(--ot-bg-card-hover);
    border-color: var(--ot-text-muted);
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: var(--ot-text-muted);
    font-size: 0.875rem;
}

.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--ot-border);
}

.auth-divider span { padding: 0 1rem; }

/* =====================================================
   Footer
   ===================================================== */
.ot-footer {
    background: var(--ot-bg-card);
    border-top: 1px solid var(--ot-border);
    padding: 2rem 0;
    margin-top: 3rem;
    color: var(--ot-text-muted);
    font-size: 0.875rem;
}

/* =====================================================
   Utilities
   ===================================================== */
.text-gradient {
    background: linear-gradient(135deg, var(--ot-primary), var(--ot-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.badge-ot {
    padding: 0.4em 0.8em;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.75rem;
}

/* =====================================================
   Luxury Additions
   ===================================================== */
.stat-card {
    text-align: center;
    padding: 2rem;
    background: var(--ot-bg-card);
    border-radius: var(--ot-radius);
    border: 1px solid var(--ot-border);
    transition: var(--ot-transition);
}
.stat-card:hover { transform: translateY(-5px); border-color: var(--ot-primary); }
.stat-card h3 { font-size: 2.5rem; font-weight: 800; margin-bottom: 0.25rem; color: var(--ot-primary); }
.stat-card p { color: var(--ot-text-muted); font-weight: 500; margin-bottom: 0; }

.feature-box {
    padding: 2rem;
    border-radius: var(--ot-radius);
    background: var(--ot-bg-card);
    border: 1px solid var(--ot-border);
    height: 100%;
}
.feature-icon {
    width: 60px;
    height: 60px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--ot-primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.step-card {
    text-align: center;
    position: relative;
    padding: 1rem;
}
.step-number {
    width: 40px;
    height: 40px;
    background: var(--ot-primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fadeInUp { animation: fadeInUp 0.6s ease-out forwards; }

/* Luxury Elements Dark Mode */
body.dark .stat-card { background: #1e293b; border-color: #334155; }
body.dark .stat-card h3 { color: var(--ot-primary-light); }
body.dark .feature-box { background: #1e293b; border-color: #334155; }
body.dark .feature-icon { background: rgba(99, 102, 241, 0.2); color: var(--ot-primary-light); }
body.dark .step-number { box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2); }
body.dark .bg-light.p-4.p-md-5 { background-color: #1e293b !important; }

/* Podium Dark Mode */
body.dark .ot-card[style*="background: linear-gradient(180deg, #f8fafc, #e2e8f0)"] { 
    background: linear-gradient(180deg, #1e293b, #0f172a) !important;
    border: 1px solid #334155 !important;
}
body.dark .ot-card[style*="background: linear-gradient(180deg, #fffbeb, #fef3c7)"] { 
    background: linear-gradient(180deg, #334155, #1e293b) !important;
    border: 2px solid #f59e0b !important;
}
body.dark .ot-card[style*="background: linear-gradient(180deg, #fff7ed, #ffedd5)"] { 
    background: linear-gradient(180deg, #1e293b, #0f172a) !important;
    border: 1px solid #334155 !important;
}

/* Exam Cards Dark Mode */
body.dark .exam-card { background: #1e293b; border-color: #334155; }
body.dark .exam-card:hover { border-color: var(--ot-primary); }

/* Responsive adjustments */
@media (max-width: 768px) {
    .ot-hero h1 { font-size: 1.5rem; }
    .ot-hero { padding: 2rem 0; }
    .section-header h2 { font-size: 1.25rem; }
}
