/* static/css/base.css */

/* ══════════════════════════════════════════════
   1. GOOGLE FONTS IMPORT
   ══════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ══════════════════════════════════════════════
   2. CSS VARIABLES — DESIGN TOKENS
   ══════════════════════════════════════════════ */
:root {
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Primary Color — Emerald */
    --emerald-50:  #ecfdf5;
    --emerald-100: #d1fae5;
    --emerald-400: #34d399;
    --emerald-500: #10b981;
    --emerald-600: #059669;
    --emerald-700: #047857;

    /* Light Theme */
    --bg-main:      #f1f5f9;
    --bg-card:      #ffffff;
    --bg-header:    rgba(255, 255, 255, 0.90);
    --bg-input:     #f8fafc;
    --bg-sidebar:   #ffffff;
    --border-color: rgba(226, 232, 240, 0.8);
    --text-main:    #0f172a;
    --text-sub:     #64748b;
    --text-muted:   #94a3b8;
    --bg-hover:     #f1f5f9;
    --shadow-sm:    0 4px 20px rgba(15, 23, 42, .04);
    --shadow-md:    0 12px 34px rgba(15, 23, 42, .08);
    --shadow-lg:    0 20px 52px rgba(15, 23, 42, .12);
    --shadow-card:  0 10px 40px rgba(15, 23, 42, .055);

    /* Sizing */
    --navbar-height: 72px;
    --sidebar-width: 260px;
    --border-radius: 1rem;
}

[data-bs-theme="dark"] {
    --bg-main:      #080B13;
    --bg-card:      #0F141F;
    --bg-header:    rgba(8, 11, 19, 0.90);
    --bg-input:     #151B29;
    --bg-sidebar:   #0B101A;
    --border-color: rgba(255, 255, 255, 0.06);
    --text-main:    #f1f5f9;
    --text-sub:     #94a3b8;
    --text-muted:   #64748b;
    --bg-hover:     rgba(255, 255, 255, 0.05);
    --shadow-sm:    0 1px 3px rgba(0,0,0,.3);
    --shadow-md:    0 4px 16px rgba(0,0,0,.3);
    --shadow-lg:    0 8px 32px rgba(0,0,0,.4);
}

/* ══════════════════════════════════════════════
   3. BASE RESET & GLOBAL
   ══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family:      var(--font-sans);
    background-color: var(--bg-main);
    color:            var(--text-main);
    transition:       background-color .3s ease, color .3s ease;
    overflow-x:       hidden;
    min-height:       100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* ══════════════════════════════════════════════
   4. LAYOUT
   ══════════════════════════════════════════════ */
.app-navbar {
    min-height:    var(--navbar-height);
    padding-top:    .5rem;
    padding-bottom: .5rem;
    background:     var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom:  1px solid var(--border-color);
    position:       sticky;
    top:            0;
    z-index:        1030;
    transition:     background .3s ease;
    box-shadow:     0 1px 0 rgba(15, 23, 42, .03);
}

.app-wrapper {
    display:    flex;
    min-height: calc(100vh - var(--navbar-height));
}

.app-sidebar {
    width:       var(--sidebar-width);
    min-width:   var(--sidebar-width);
    background:  var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    position:    sticky;
    top:         var(--navbar-height);
    height:      calc(100vh - var(--navbar-height));
    overflow-y:  auto;
    transition:  width .3s ease, background .3s ease;
}

.app-content {
    flex:       1;
    min-width:  0;
    padding:    1.75rem;
}

.app-content-flush {
    padding: 0;
}

.nav-link-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: 1rem;
    padding: .65rem 1rem;
    color: var(--text-sub);
    font-size: .875rem;
    font-weight: 850;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    isolation: isolate;
    transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.nav-link-pill svg {
    color: currentColor;
    opacity: .86;
    transition: opacity .18s ease, transform .18s ease;
}

.nav-link-pill::after {
    content: "";
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: .32rem;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    opacity: 0;
    transform: scaleX(.45);
    transition: opacity .18s ease, transform .18s ease;
}

.nav-link-pill:hover {
    background: rgba(236, 253, 245, .72);
    border-color: rgba(16, 185, 129, .16);
    color: var(--emerald-700);
    box-shadow: 0 8px 20px rgba(15, 23, 42, .045);
    transform: translateY(-1px);
}

.nav-link-pill.active {
    background: linear-gradient(135deg, rgba(236, 253, 245, .96), rgba(209, 250, 229, .62));
    border-color: rgba(16, 185, 129, .14);
    color: var(--emerald-700);
    box-shadow: 0 10px 24px rgba(16, 185, 129, .10);
}

.nav-link-pill:hover svg,
.nav-link-pill.active svg {
    opacity: 1;
    transform: translateY(-1px);
}

.nav-link-pill.active::after {
    opacity: .5;
    transform: scaleX(1);
}

.nav-link-pill:focus-visible {
    outline: 3px solid rgba(16, 185, 129, .24);
    outline-offset: 3px;
}

[data-bs-theme="dark"] .nav-link-pill:hover {
    background: rgba(16, 185, 129, .10);
    border-color: rgba(52, 211, 153, .16);
    color: var(--emerald-400);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .18);
}

[data-bs-theme="dark"] .nav-link-pill.active {
    background: linear-gradient(135deg, rgba(16, 185, 129, .18), rgba(52, 211, 153, .08));
    border-color: rgba(52, 211, 153, .18);
    color: var(--emerald-400);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .20);
}

.icon-btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: .75rem;
    color: var(--text-main);
    border: 0;
    background: transparent;
}

.icon-btn:hover {
    background: var(--bg-hover);
}

.account-menu-btn {
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: 1rem;
    padding: .35rem .55rem;
    background: transparent;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.account-menu-btn:hover,
.account-menu-btn.show {
    background: rgba(236, 253, 245, .70);
    border-color: rgba(16, 185, 129, .18);
    box-shadow: 0 10px 24px rgba(15, 23, 42, .055);
    transform: translateY(-1px);
}

.account-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border: 2px solid rgba(255, 255, 255, .85);
    box-shadow: 0 8px 20px rgba(16, 185, 129, .22);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.account-avatar--initials {
    background: linear-gradient(135deg, var(--emerald-500), #13c78b);
    font-size: .76rem;
}

.account-menu-btn:hover .account-avatar,
.account-menu-btn.show .account-avatar {
    transform: scale(1.06);
    border-color: rgba(209, 250, 229, .95);
    box-shadow: 0 10px 28px rgba(16, 185, 129, .30);
}

.account-menu-btn [data-lucide="chevron-down"] {
    transition: transform .18s ease, color .18s ease;
}

.account-menu-btn:hover [data-lucide="chevron-down"],
.account-menu-btn.show [data-lucide="chevron-down"] {
    color: var(--emerald-600) !important;
}

.account-menu-btn.show [data-lucide="chevron-down"] {
    transform: rotate(180deg);
}

.account-dropdown {
    min-width: 290px;
    padding: .55rem;
    border: 1px solid var(--border-color);
    border-radius: 1.05rem;
    background: var(--bg-card);
    background-color: var(--bg-card) !important;
    box-shadow: 0 22px 52px rgba(15, 23, 42, .14);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.account-dropdown__header {
    margin: .1rem .1rem .45rem;
    padding: .8rem .9rem;
    border-radius: .9rem;
    background: linear-gradient(135deg, rgba(236, 253, 245, .86), rgba(248, 250, 252, .90));
    border: 1px solid rgba(16, 185, 129, .10);
}

.account-dropdown__section-title {
    padding: .55rem .75rem .3rem;
    color: var(--text-muted);
    font-size: .68rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.account-dropdown__item {
    display: flex;
    align-items: center;
    gap: .55rem;
    min-height: 40px;
    border-radius: .78rem;
    padding: .62rem .75rem;
    color: var(--text-sub);
    font-size: .9rem;
    font-weight: 760;
    transition: background .16s ease, color .16s ease, transform .16s ease;
}

.account-dropdown__item svg {
    flex: 0 0 auto;
    color: currentColor;
    opacity: .86;
}

.account-dropdown__item:hover,
.account-dropdown__item:focus {
    background: var(--emerald-50);
    color: var(--emerald-700);
    transform: translateX(2px);
}

.account-dropdown__item--danger:hover,
.account-dropdown__item--danger:focus {
    background: rgba(244, 63, 94, .10);
    color: #e11d48 !important;
}

[data-bs-theme="dark"] .account-menu-btn:hover,
[data-bs-theme="dark"] .account-menu-btn.show {
    background: rgba(16, 185, 129, .10);
    border-color: rgba(52, 211, 153, .16);
}

[data-bs-theme="dark"] .account-dropdown {
    background: var(--bg-card);
    background-color: var(--bg-card) !important;
    box-shadow: 0 22px 52px rgba(0, 0, 0, .38);
}

[data-bs-theme="dark"] .account-dropdown__header {
    background: linear-gradient(135deg, rgba(16, 185, 129, .14), rgba(15, 20, 31, .88));
    border-color: rgba(52, 211, 153, .12);
}

[data-bs-theme="dark"] .account-dropdown__item:hover,
[data-bs-theme="dark"] .account-dropdown__item:focus {
    background: rgba(16, 185, 129, .12);
    color: var(--emerald-400);
}

.home-shell {
    background:
        radial-gradient(circle at 8% 3%, rgba(167, 243, 208, .42), transparent 27rem),
        radial-gradient(circle at 94% 9%, rgba(153, 246, 228, .36), transparent 30rem),
        var(--bg-main);
    min-height: calc(100vh - var(--navbar-height));
}

.home-section {
    /* Đồng bộ độ rộng + mép ngang với .app-content (1480px / 1.75rem) */
    max-width: 1480px;
    margin: 0 auto;
    padding: 3.25rem 1.75rem;
}

.home-hero {
    background: linear-gradient(135deg, rgba(236, 253, 245, .98) 0%, rgba(248, 250, 252, .94) 100%);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    box-shadow: var(--shadow-card);
    padding: clamp(2.25rem, 5vw, 4.4rem);
}

[data-bs-theme="dark"] .home-hero {
    background: linear-gradient(135deg, rgba(6, 78, 59, .32), rgba(15, 20, 31, .95));
}

.home-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    border-radius: 999px;
    background: var(--emerald-500);
    color: #fff;
    padding: .55rem .9rem;
    font-size: .75rem;
    font-weight: 900;
    text-transform: uppercase;
}

.home-title {
    max-width: 760px;
    margin: 1.5rem 0 0;
    color: var(--text-main);
    font-size: clamp(2.6rem, 6.4vw, 5.4rem);
    line-height: 1.04;
    font-weight: 900;
    letter-spacing: 0;
}

.home-title-accent {
    color: var(--emerald-500);
}

.home-lead {
    max-width: 680px;
    margin-top: 1.25rem;
    color: var(--text-sub);
    font-size: clamp(1rem, 2vw, 1.2rem);
    line-height: 1.65;
    font-weight: 650;
}

.home-feature {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: .55rem 1rem;
    font-size: .85rem;
    font-weight: 800;
}

.home-feature svg {
    color: var(--emerald-500);
}

.metric-card {
    position: relative;
    overflow: hidden;
    min-height: 116px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1.1rem;
    box-shadow: var(--shadow-card);
    padding: 1.35rem;
    isolation: isolate;
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease, background-color .22s ease;
}

.metric-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(135deg, rgba(16, 185, 129, .06), transparent 46%),
        radial-gradient(circle at 92% 15%, rgba(59, 130, 246, .07), transparent 34%);
    opacity: 0;
    transition: opacity .22s ease;
}

.metric-card > .rounded-xl {
    transition: transform .22s ease, box-shadow .22s ease, background-color .22s ease;
}

.metric-card:hover {
    transform: translateY(-3px);
    border-color: rgba(16, 185, 129, .22);
    box-shadow: 0 14px 30px rgba(15, 23, 42, .075);
}

.metric-card:hover::before {
    opacity: 1;
}

.metric-card:hover > .rounded-xl {
    transform: scale(1.025);
    box-shadow: 0 8px 18px rgba(15, 23, 42, .07);
}

[data-bs-theme="dark"] .metric-card:hover {
    border-color: rgba(52, 211, 153, .18);
    box-shadow: 0 14px 30px rgba(0, 0, 0, .24);
}

.course-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1.35rem;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.course-card:hover {
    transform: translateY(-3px);
    border-color: rgba(16,185,129,.32);
    box-shadow: 0 16px 40px rgba(16, 185, 129, .10), var(--shadow-md);
}

.course-thumb {
    height: clamp(190px, 14vw, 270px);
    background: linear-gradient(180deg, #e2e8f0, #94a3b8);
    overflow: hidden;
}

.course-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ══════════════════════════════════════════════
   5. CARDS
   ══════════════════════════════════════════════ */
.aether-card {
    background:    var(--bg-card);
    border:        1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow:    var(--shadow-sm);
    transition:    box-shadow .2s ease, transform .2s ease;
}

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

/* ══════════════════════════════════════════════
   6. SPINNER OVERLAY
   ══════════════════════════════════════════════ */
#spinner-overlay {
    position:        fixed;
    inset:           0;
    background:      rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    z-index:         9999;
    display:         flex;
    align-items:     center;
    justify-content: center;
}

#spinner-overlay .spinner-border {
    width:  3rem;
    height: 3rem;
    color:  var(--emerald-500);
}

/* ══════════════════════════════════════════════
   7. BUTTONS
   ══════════════════════════════════════════════ */
.btn-emerald {
    background-color: var(--emerald-500);
    border-color:     var(--emerald-500);
    color:            #fff;
    font-weight:      800;
    box-shadow:       0 10px 24px rgba(16, 185, 129, .22);
    transition:       background-color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .1s ease;
}

.btn-emerald:hover {
    background-color: var(--emerald-600);
    border-color:     var(--emerald-600);
    color:            #fff;
    box-shadow:       0 12px 28px rgba(16, 185, 129, .30);
    transform:        translateY(-1px);
}

.btn-auth,
.home-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border-radius: .9rem;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: 0;
    white-space: nowrap;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background-color .16s ease, color .16s ease;
}

.btn-auth svg,
.home-cta-btn svg {
    flex: 0 0 auto;
}

.btn-auth {
    min-height: 42px;
    padding: .55rem .95rem;
}

.btn-auth-secondary,
.home-cta-secondary {
    background: rgba(255, 255, 255, .78);
    border: 1px solid rgba(148, 163, 184, .58);
    color: var(--text-sub);
    box-shadow: 0 8px 20px rgba(15, 23, 42, .045);
}

.btn-auth-secondary:hover,
.home-cta-secondary:hover {
    background: var(--emerald-50);
    border-color: rgba(16, 185, 129, .38);
    color: var(--emerald-700);
    box-shadow: 0 12px 28px rgba(16, 185, 129, .14);
    transform: translateY(-2px);
}

.btn-auth-primary,
.home-cta-primary {
    background: linear-gradient(135deg, var(--emerald-500), #14c98c);
    border: 1px solid rgba(16, 185, 129, .82);
    color: #fff;
    box-shadow: 0 16px 34px rgba(16, 185, 129, .26);
}

.btn-auth-primary:hover,
.home-cta-primary:hover {
    background: linear-gradient(135deg, var(--emerald-600), var(--emerald-500));
    border-color: var(--emerald-600);
    color: #fff;
    box-shadow: 0 18px 38px rgba(16, 185, 129, .34);
    transform: translateY(-2px);
}

.home-cta-btn {
    min-height: 64px;
    padding: 1rem 1.6rem;
    border-radius: 1rem;
    font-size: 1rem;
}

.btn-auth:focus-visible,
.home-cta-btn:focus-visible {
    outline: 3px solid rgba(16, 185, 129, .28);
    outline-offset: 3px;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, .12);
}

[data-bs-theme="dark"] .btn-auth-secondary,
[data-bs-theme="dark"] .home-cta-secondary {
    background: rgba(15, 20, 31, .78);
    border-color: rgba(148, 163, 184, .24);
    color: var(--text-main);
}

[data-bs-theme="dark"] .btn-auth-secondary:hover,
[data-bs-theme="dark"] .home-cta-secondary:hover {
    background: rgba(16, 185, 129, .13);
    border-color: rgba(52, 211, 153, .36);
    color: var(--emerald-400);
}

.btn-outline-success,
.btn-success {
    font-weight: 800;
}

.btn-success {
    --bs-btn-bg: var(--emerald-600);
    --bs-btn-border-color: var(--emerald-600);
    --bs-btn-hover-bg: var(--emerald-500);
    --bs-btn-hover-border-color: var(--emerald-500);
    --bs-btn-active-bg: var(--emerald-700);
    --bs-btn-active-border-color: var(--emerald-700);
}

.btn-outline-success {
    --bs-btn-color: var(--emerald-600);
    --bs-btn-border-color: var(--emerald-600);
    --bs-btn-hover-bg: var(--emerald-600);
    --bs-btn-hover-border-color: var(--emerald-600);
}

/* ══════════════════════════════════════════════
   8. SIDEBAR NAV ITEMS
   ══════════════════════════════════════════════ */
.sidebar-nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: .7rem;
    min-height: 44px;
    margin-bottom: .25rem;
    border: 1px solid transparent;
    border-radius: .9rem;
    padding: .72rem .85rem;
    color: var(--text-sub);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 780;
    line-height: 1.1;
    isolation: isolate;
    transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.sidebar-nav-item::before {
    content: "";
    position: absolute;
    left: .45rem;
    top: 50%;
    width: 3px;
    height: 46%;
    border-radius: 999px;
    background: currentColor;
    opacity: 0;
    transform: translateY(-50%) scaleY(.45);
    transition: opacity .16s ease, transform .16s ease;
}

.sidebar-nav-item svg {
    flex: 0 0 auto;
    color: currentColor;
    opacity: .82;
    transition: opacity .16s ease, transform .16s ease;
}

.sidebar-nav-item:hover {
    background: rgba(236, 253, 245, .70);
    border-color: rgba(16, 185, 129, .14);
    color: var(--emerald-700);
    box-shadow: 0 8px 20px rgba(15, 23, 42, .04);
    transform: translateX(2px);
}

.sidebar-nav-item.active {
    background: linear-gradient(135deg, rgba(236, 253, 245, .96), rgba(209, 250, 229, .58));
    border-color: rgba(16, 185, 129, .16);
    color: var(--emerald-700);
    box-shadow: 0 10px 24px rgba(16, 185, 129, .09);
}

.sidebar-nav-item:hover svg,
.sidebar-nav-item.active svg {
    opacity: 1;
    transform: translateY(-1px);
}

.sidebar-nav-item.active::before {
    opacity: .58;
    transform: translateY(-50%) scaleY(1);
}

[data-bs-theme="dark"] .sidebar-nav-item:hover {
    background: rgba(16, 185, 129, .10);
    border-color: rgba(52, 211, 153, .14);
    color: var(--emerald-400);
}

[data-bs-theme="dark"] .sidebar-nav-item.active {
    background: linear-gradient(135deg, rgba(16, 185, 129, .17), rgba(52, 211, 153, .08));
    border-color: rgba(52, 211, 153, .18);
    color: var(--emerald-400);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .20);
}

/* ══════════════════════════════════════════════
   9. BADGES & TAGS
   ══════════════════════════════════════════════ */
.badge-role-admin      { background: #fee2e2; color: #dc2626; }
.badge-role-instructor { background: #fef3c7; color: #d97706; }
.badge-role-student    { background: #dbeafe; color: #2563eb; }

[data-bs-theme="dark"] .badge-role-admin      { background: rgba(220,38,38,.2);  color: #f87171; }
[data-bs-theme="dark"] .badge-role-instructor { background: rgba(217,119,6,.2);  color: #fbbf24; }
[data-bs-theme="dark"] .badge-role-student    { background: rgba(37,99,235,.2);  color: #60a5fa; }

/* ══════════════════════════════════════════════
   10. PROGRESS BAR
   ══════════════════════════════════════════════ */
.progress-emerald .progress-bar {
    background: linear-gradient(90deg, var(--emerald-500), var(--emerald-400));
}

/* ══════════════════════════════════════════════
   11. UTILITY
   ══════════════════════════════════════════════ */
.text-emerald  { color: var(--emerald-500) !important; }
.text-main     { color: var(--text-main) !important; }
.text-sub      { color: var(--text-sub) !important; }
.text-muted    { color: var(--text-muted) !important; }
.bg-card       { background-color: var(--bg-card) !important; }
.border-theme  { border-color: var(--border-color) !important; }
.fw-semibold   { font-weight: 600 !important; }
.fw-black      { font-weight: 900 !important; }
.rounded-xl    { border-radius: 0.75rem !important; }
.rounded-2xl   { border-radius: 1rem !important; }
.rounded-3xl   { border-radius: 1.5rem !important; }
.rounded-4xl   { border-radius: 2rem !important; }
.shadow-soft   { box-shadow: var(--shadow-sm) !important; }
.shadow-card   { box-shadow: var(--shadow-card) !important; }
.tracking-wide { letter-spacing: .025em !important; }
.tracking-wider { letter-spacing: .05em !important; }
.leading-relaxed { line-height: 1.625 !important; }

.filter-pill {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    border: 1px solid var(--border-color);
    border-radius: .85rem;
    background: var(--bg-card);
    color: var(--text-sub);
    padding: .55rem .95rem;
    font-size: .92rem;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(15, 23, 42, .035);
    transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}

button.filter-pill {
    cursor: pointer;
}

.filter-pill:hover,
.filter-pill.active {
    border-color: rgba(16, 185, 129, .22);
    background: var(--emerald-50);
    color: var(--emerald-700);
    box-shadow: 0 8px 22px rgba(16, 185, 129, .08);
}

.filter-pill:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, .16);
}

[data-bs-theme="dark"] .filter-pill:hover,
[data-bs-theme="dark"] .filter-pill.active {
    background: rgba(16, 185, 129, .14);
    color: var(--emerald-400);
}

.course-category-badge {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    border-radius: 999px;
    background: rgba(16, 185, 129, .11);
    color: var(--emerald-600);
    padding: .35rem .7rem;
    font-size: .78rem;
    font-weight: 900;
    line-height: 1;
}

.course-level-badge {
    border-radius: 999px;
    background: rgba(255,255,255,.28);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    padding: .35rem .7rem;
    font-size: .72rem;
    font-weight: 900;
}

.course-price {
    color: var(--emerald-500);
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1;
}

.course-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .9rem;
    color: var(--text-sub);
    font-size: .86rem;
    font-weight: 700;
}

.course-meta i {
    color: var(--text-muted);
}

.course-meta .bi-star-fill {
    color: #fbbf24;
}

/* ══════════════════════════════════════════════
   12. RESPONSIVE — ẨN SIDEBAR KHI < MD
   ══════════════════════════════════════════════ */
@media (max-width: 767px) {
    .app-sidebar {
        position: fixed;
        left: calc(var(--sidebar-width) * -1);
        z-index: 1025;
        top: var(--navbar-height);
        height: calc(100vh - var(--navbar-height));
        transition: left .3s ease;
    }

    .app-sidebar.show { left: 0; }

    .app-content { padding: 1rem; }
}


/* ══════════════════════════════════════════════
   HTMX — INDICATORS & LOADING STATES
   ══════════════════════════════════════════════ */

/**
 * .htmx-indicator: ẩn mặc định, hiện khi có HTMX request đang chạy.
 * HTMX tự thêm class .htmx-request vào element cha của indicator.
 */
.htmx-indicator {
    display: none !important;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: flex !important;
    opacity: 1;
}

/**
 * Spinner nhỏ nội tuyến — dùng trong button khi đang submit
 * Usage: <button hx-post="..." hx-indicator=".btn-spinner">
 *          <span class="htmx-indicator btn-spinner spinner-border spinner-border-sm"></span>
 *          Lưu
 *        </button>
 */
.btn-spinner {
    width: 0.9rem;
    height: 0.9rem;
    border-width: 2px;
    margin-right: 0.35rem;
    vertical-align: -0.1em;
}

/**
 * Hiệu ứng mờ dần cho vùng đang được HTMX reload (tốt cho UX)
 * Usage: thêm class "htmx-fade-region" vào container được swap
 */
.htmx-request .htmx-fade-region {
    opacity: 0.4;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

/**
 * Pulse animation cho skeleton loading
 */
@keyframes htmx-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}
.htmx-skeleton {
    background: var(--border-color);
    border-radius: 0.5rem;
    animation: htmx-pulse 1.5s ease-in-out infinite;
}

/* Coursera Navbar Navigation Styles */
.btn-hover-active {
    background: var(--emerald-50) !important;
    color: var(--emerald-600) !important;
}

[data-bs-theme="dark"] .btn-hover-active {
    background: rgba(16, 185, 129, 0.12) !important;
    color: var(--emerald-400) !important;
}

/* Adjust layout since sidebar is removed */
.app-content {
    max-width: 1480px;
    margin: 0 auto;
    width: 100%;
}

.app-content.app-content-flush {
    max-width: none;
    margin: 0;
    width: 100%;
}

.dashboard-workspace {
    max-width: none;
    padding: 0;
}

.manager-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: calc(100vh - var(--navbar-height));
    background: var(--bg-main);
}

.manager-sidebar {
    position: sticky;
    top: var(--navbar-height);
    height: calc(100vh - var(--navbar-height));
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
    background: var(--bg-card);
    padding: 1rem .75rem;
}

.manager-sidebar__section + .manager-sidebar__section {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.manager-sidebar__label {
    padding: 0 .85rem .45rem;
    color: var(--text-muted);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.mobile-nav-offcanvas {
    width: min(86vw, 320px);
    max-width: 320px;
    background: var(--bg-card);
    box-shadow: 18px 0 48px rgba(15, 23, 42, .12);
}

.mobile-nav-offcanvas__header {
    padding: 1rem;
}

.mobile-nav-offcanvas__body {
    gap: .25rem;
    padding: 1rem;
}

.offcanvas-nav-section {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    margin-top: .9rem;
}

.offcanvas-nav-section + .offcanvas-nav-section {
    margin-top: 1rem;
    padding-top: .9rem;
    border-top: 1px solid var(--border-color);
}

.offcanvas-nav-label {
    padding: .2rem .75rem .35rem;
}

.offcanvas-nav-item {
    width: 100%;
    min-height: 46px;
    justify-content: flex-start;
    border-radius: .95rem;
}

.offcanvas-nav-item--danger:hover,
.offcanvas-nav-item--danger:focus {
    background: rgba(244, 63, 94, .10);
    border-color: rgba(244, 63, 94, .16);
    color: #e11d48 !important;
}

.mobile-nav-account {
    margin-top: auto;
    padding-top: 1rem;
}

[data-bs-theme="dark"] .mobile-nav-offcanvas {
    box-shadow: 18px 0 48px rgba(0, 0, 0, .40);
}

.manager-main {
    min-width: 0;
    padding: 1.5rem;
}

.manager-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.manager-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    color: var(--emerald-600);
    font-size: .8rem;
    font-weight: 800;
    text-transform: uppercase;
}

.manager-title {
    margin: .35rem 0;
    color: var(--text-main);
    font-size: clamp(1.75rem, 3vw, 2.4rem);
    font-weight: 900;
}

.manager-subtitle {
    max-width: 720px;
    margin: 0;
    color: var(--text-sub);
    font-weight: 600;
}

.manager-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.metric-icon {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: .75rem;
    flex: 0 0 auto;
}

.metric-icon--green { background: rgba(16,185,129,.12); color: var(--emerald-600); }
.metric-icon--blue { background: rgba(59,130,246,.12); color: #2563eb; }
.metric-icon--amber { background: rgba(245,158,11,.14); color: #d97706; }
.metric-icon--violet { background: rgba(139,92,246,.13); color: #7c3aed; }

.manager-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.manager-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: .75rem;
    box-shadow: var(--shadow-sm);
    padding: 1rem;
    margin-bottom: 1rem;
}

.manager-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .75rem;
}

.manager-panel__head h2 {
    margin: 0;
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 900;
}

.manager-panel__head span {
    color: var(--text-sub);
    font-size: .8rem;
    font-weight: 800;
}

.manager-list {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.manager-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 56px;
    border: 1px solid var(--border-color);
    border-radius: .6rem;
    padding: .75rem;
    color: var(--text-sub);
    text-decoration: none;
    background: var(--bg-main);
}

.manager-list-item:hover {
    border-color: rgba(16,185,129,.45);
    color: var(--emerald-600);
}

.manager-list-title {
    color: var(--text-main);
    font-size: .9rem;
    font-weight: 800;
}

.manager-list-meta {
    color: var(--text-sub);
    font-size: .78rem;
    font-weight: 600;
}

.manager-empty {
    border: 1px dashed var(--border-color);
    border-radius: .6rem;
    padding: 1rem;
    color: var(--text-sub);
    font-size: .875rem;
    font-weight: 700;
    text-align: center;
}

.manager-table {
    display: flex;
    flex-direction: column;
    overflow-x: auto;
}

.manager-table__row {
    display: grid;
    grid-template-columns: 1fr 2fr 1.4fr .9fr;
    gap: 1rem;
    min-width: 760px;
    border-bottom: 1px solid var(--border-color);
    padding: .75rem 0;
    color: var(--text-sub);
    font-size: .85rem;
    font-weight: 600;
}

.manager-table__row--link {
    text-decoration: none;
}

.manager-table__row--link:hover {
    background: rgba(16,185,129,.05);
    color: var(--emerald-600);
}

.manager-table__title-link {
    color: var(--emerald-600);
    text-decoration: none;
}

.manager-table__title-link:hover {
    color: var(--emerald-700);
    text-decoration: underline;
}

[data-bs-theme="dark"] .manager-table__title-link {
    color: var(--emerald-400);
}

[data-bs-theme="dark"] .manager-table__title-link:hover {
    color: var(--emerald-500);
}

.manager-table__row--head {
    color: var(--text-muted);
    font-size: .72rem;
    font-weight: 900;
    text-transform: uppercase;
}

@media (max-width: 991px) {
    /* Navbar thấp hơn trên mobile — các offset sticky ăn theo biến này */
    :root {
        --navbar-height: 56px;
    }

    .app-navbar {
        padding-top: .3rem;
        padding-bottom: .3rem;
    }

    .manager-layout {
        grid-template-columns: 1fr;
    }

    /* Sidebar quản lý ẩn trên mobile — link nằm trong offcanvas menu của navbar */

    .manager-metrics,
    .manager-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575px) {
    .manager-main {
        padding: 1rem;
    }

    .manager-header {
        flex-direction: column;
    }

    /* Giữ 2 cột chỉ số trên điện thoại, card nén lại để thấy nhiều thông tin hơn */
    .manager-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .6rem;
    }

    .manager-grid {
        grid-template-columns: 1fr;
    }

    .metric-card {
        min-height: 0;
        padding: .85rem;
        border-radius: .9rem;
    }

    .metric-card .h3 {
        font-size: 1.3rem;
    }

    .home-cta-btn {
        min-height: 52px;
        padding: .8rem 1rem;
        border-radius: .85rem;
        font-size: .94rem;
    }

    .btn-auth {
        min-height: 40px;
        padding: .55rem .85rem;
    }

    .metric-icon {
        width: 38px;
        height: 38px;
    }

    /* Hero + section trang chủ gọn lại trên điện thoại */
    .home-section {
        padding: 1.75rem 1rem;
    }

    .home-hero {
        padding: 1.4rem;
        border-radius: 1.1rem;
    }

    .home-title {
        margin-top: 1rem;
    }

    .home-lead {
        margin-top: .75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .btn-auth,
    .home-cta-btn,
    .metric-card,
    .metric-card::before,
    .metric-card > .rounded-xl,
    .account-menu-btn,
    .account-avatar,
    .account-menu-btn [data-lucide="chevron-down"],
    .account-dropdown__item,
    .sidebar-nav-item,
    .sidebar-nav-item::before,
    .sidebar-nav-item svg {
        transition: none;
    }

    .btn-auth:hover,
    .home-cta-btn:hover,
    .metric-card:hover,
    .metric-card:hover > .rounded-xl,
    .account-menu-btn:hover,
    .account-menu-btn:hover .account-avatar,
    .account-menu-btn.show .account-avatar,
    .account-menu-btn.show [data-lucide="chevron-down"],
    .account-dropdown__item:hover,
    .sidebar-nav-item:hover,
    .sidebar-nav-item:hover svg,
    .sidebar-nav-item.active svg {
        transform: none;
    }
}

/* ============================================================
   Auth pages (login/register) — layout 2 panel trái/phải
   ============================================================ */
.auth-shell {
    min-height: calc(100vh - var(--navbar-height, 70px) - 48px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}
.auth-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    width: 100%;
    max-width: 1080px;
    border-radius: 1.5rem;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg, 0 24px 60px rgba(15, 23, 42, .14));
}
.auth-side {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 3rem 2.75rem;
    color: #fff;
    background: linear-gradient(150deg, #047857 0%, #059669 45%, #14b8a6 100%);
}
.auth-side::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 85% 12%, rgba(255, 255, 255, .16), transparent 20rem);
    pointer-events: none;
}
.auth-side > * { position: relative; z-index: 1; }
.auth-side__brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .75rem;
}
.auth-side__logo {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    background: rgba(255, 255, 255, .18);
    border: 1px solid rgba(255, 255, 255, .28);
}
.auth-side__title {
    font-size: clamp(1.7rem, 2.6vw, 2.4rem);
    font-weight: 900;
    line-height: 1.18;
    margin: 0;
}
.auth-side__subtitle {
    font-size: .98rem;
    line-height: 1.65;
    opacity: .92;
    max-width: 40ch;
}
.auth-feature {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .8rem 1rem;
    border-radius: .9rem;
    font-weight: 600;
    font-size: .9rem;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .22);
}
.auth-side__footer {
    margin-top: auto;
    padding-top: 1.5rem;
    font-size: .82rem;
    opacity: .82;
}
.auth-form-panel {
    padding: 3rem 2.75rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.auth-eyebrow {
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--text-sub, #64748b);
    margin-bottom: .35rem;
}
.auth-heading {
    font-weight: 900;
    font-size: clamp(1.5rem, 2.2vw, 2rem);
    line-height: 1.2;
}
.auth-input-group { position: relative; }
.auth-input-group .form-control { padding-right: 2.8rem; }
.auth-eye-toggle {
    position: absolute;
    top: 50%;
    right: .6rem;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--text-sub, #64748b);
    padding: .25rem .45rem;
    line-height: 1;
}
.auth-demo-box {
    border: 1.5px dashed var(--border-color);
    border-radius: 1rem;
    padding: 1rem 1.15rem;
    background: var(--bg-main);
}
.auth-demo-account {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    width: 100%;
    text-align: left;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: .75rem;
    padding: .55rem .85rem;
    font-size: .85rem;
    transition: border-color .15s ease, transform .15s ease;
}
.auth-demo-account:hover {
    border-color: var(--emerald-500);
    transform: translateY(-1px);
}
@media (max-width: 991.98px) {
    .auth-card { grid-template-columns: 1fr; max-width: 560px; }
    .auth-side { display: none; }
    .auth-form-panel { padding: 2.25rem 1.5rem; }
}
