:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #64748b;
    --success: #16a34a;
    --success-light: #dcfce7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --info: #0891b2;
    --info-light: #cffafe;
    --dark: #1e293b;
    --gray: #64748b;
    --gray-light: #f1f5f9;
    --white: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-sm: 4px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font);
    color: var(--dark);
    background: var(--gray-light);
    line-height: 1.6;
}

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

img { max-width: 100%; height: auto; }

/* ── NAVBAR ─────────────────────────────────────────── */
.navbar {
    background: var(--white);
    padding: 0 2rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand a {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.navbar-menu a { color: var(--dark); font-weight: 500; }
.navbar-menu a:hover { color: var(--primary); }

/* ── BUTTONS ────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); color: var(--white); }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { opacity: 0.9; color: var(--white); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { opacity: 0.9; color: var(--white); }
.btn-warning { background: var(--warning); color: var(--white); }
.btn-secondary { background: var(--secondary); color: var(--white); }
.btn-secondary:hover { opacity: 0.9; color: var(--white); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--dark); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.8rem 1.6rem; font-size: 1rem; }
.btn-block { display: block; width: 100%; text-align: center; }

/* ── FORMS ──────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
    font-size: 0.875rem;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: var(--font);
    transition: border-color 0.2s;
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

textarea.form-control { min-height: 100px; resize: vertical; }
select.form-control { appearance: auto; }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-check input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }
.form-text { font-size: 0.8rem; color: var(--gray); margin-top: 0.25rem; }

/* ── ALERTS ─────────────────────────────────────────── */
.alert {
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-success { background: var(--success-light); color: var(--success); border-left: 4px solid var(--success); }
.alert-error { background: var(--danger-light); color: var(--danger); border-left: 4px solid var(--danger); }
.alert-warning { background: var(--warning-light); color: var(--warning); border-left: 4px solid var(--warning); }
.alert-info { background: var(--info-light); color: var(--info); border-left: 4px solid var(--info); }

/* ── CARDS ──────────────────────────────────────────── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h2, .card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.card-body { padding: 1.25rem; }
.card-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border); }

/* ── TABLES ─────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th, .table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-weight: 600;
    color: var(--gray);
    background: var(--gray-light);
    white-space: nowrap;
}

.table tbody tr:hover { background: #f8fafc; }

.table .actions { white-space: nowrap; display: flex; gap: 0.5rem; }

/* ── BADGES ─────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-secondary { background: var(--gray-light); color: var(--gray); }

/* ── PAGINATION ─────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 1rem 0;
}

.pagination a, .pagination span {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--dark);
}

.pagination a:hover { background: var(--primary-light); border-color: var(--primary); }
.pagination .active { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* ── COURSE CARDS (Catalog) ─────────────────────────── */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem 0;
}

.course-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.course-card-image {
    height: 180px;
    background: var(--primary-light);
    background-size: cover;
    background-position: center;
}

.course-card-body { padding: 1.25rem; }
.course-card-body h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.course-card-body p { color: var(--gray); font-size: 0.875rem; margin-bottom: 0.75rem; }

.course-card-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.course-price { font-size: 1.25rem; font-weight: 700; color: var(--primary); }
.course-category { font-size: 0.8rem; color: var(--gray); }

/* ── AUTH PAGES ──────────────────────────────────────── */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 2.5rem;
}

.auth-card h1 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.auth-card .subtitle {
    text-align: center;
    color: var(--gray);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.auth-links {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.875rem;
}

/* ── ERROR PAGES ────────────────────────────────────── */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.error-container {
    text-align: center;
}

.error-container h1 {
    font-size: 6rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.error-container p {
    font-size: 1.2rem;
    color: var(--gray);
    margin-bottom: 2rem;
}

/* ── MAIN CONTENT ───────────────────────────────────── */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.footer {
    text-align: center;
    padding: 2rem;
    color: var(--gray);
    font-size: 0.85rem;
}

/* ── UTILITIES ──────────────────────────────────────── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.d-flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }

/* ── VIDEO CONTAINER ────────────────────────────────── */
.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ── STATS GRID ─────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--gray);
    margin-top: 0.25rem;
}

@media (max-width: 768px) {
    .navbar { padding: 0 1rem; }
    .navbar-menu { gap: 0.75rem; }
    .main-content { padding: 1rem; }
    .course-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}
