/* =====================================================
   SỐNG CÙNG AI — 2.0 ĐÔNG SƠN BRAND IDENTITY SYSTEM
   Tagline: TRI THỨC – CÔNG NGHỆ – CUỘC SỐNG
   Creative: Tinh hoa Việt. Tư duy mới.
   Palette:
     --ink:        #101A16 (Đen xanh sơn mài)
     --surface:    #18251F (Xanh rêu đậm bề mặt)
     --surface-2:  #1F3028 (Xanh ngọc cổ nâng tầng)
     --bronze:     #C99D50 (Vàng đồng Đông Sơn)
     --light-gold: #E8CE97 (Vàng kim sáng)
     --ivory:      #F6F0E4 (Trắng ngà giấy dó)
     --muted:      #A2ADA3 (Xám lục nhạt)
     --line:       #304037 (Đường viền đồng cổ)
   Typography: Be Vietnam Pro (Local Full Vietnamese UTF-8)
   ===================================================== */

@font-face {
  font-family: 'Be Vietnam Pro';
  src: url('/assets/fonts/BeVietnamPro-400-vietnamese.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  src: url('/assets/fonts/BeVietnamPro-400-latin-ext.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  src: url('/assets/fonts/BeVietnamPro-400-latin.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Be Vietnam Pro';
  src: url('/assets/fonts/BeVietnamPro-500-vietnamese.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  src: url('/assets/fonts/BeVietnamPro-500-latin-ext.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  src: url('/assets/fonts/BeVietnamPro-500-latin.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Be Vietnam Pro';
  src: url('/assets/fonts/BeVietnamPro-600-vietnamese.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  src: url('/assets/fonts/BeVietnamPro-600-latin-ext.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  src: url('/assets/fonts/BeVietnamPro-600-latin.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Be Vietnam Pro';
  src: url('/assets/fonts/BeVietnamPro-700-vietnamese.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  src: url('/assets/fonts/BeVietnamPro-700-latin-ext.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  src: url('/assets/fonts/BeVietnamPro-700-latin.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ===== CSS Variables — Đông Sơn 2.0 + Legacy Mapping ===== */
:root {
  --ink: #101A16;
  --surface: #18251F;
  --surface-2: #1F3028;
  --bronze: #C99D50;
  --bronze-deep: #8E6424;
  --light-gold: #E8CE97;
  --ivory: #F6F0E4;
  --muted: #A2ADA3;
  --line: #304037;
  --success: #3DB878;
  --danger: #E05858;
  --warning: #E5A93B;

  /* Map legacy variables to Đông Sơn 2.0 so existing components transform seamlessly */
  --cream: #101A16;
  --white: #18251F;
  --gray: #1F3028;
  --navy: #F6F0E4;
  --text: #F6F0E4;
  --yellow: #C99D50;
  --yellow-d: #8E6424;
  --pink: #C99D50;
  --pink-d: #A67B32;
  --teal: #2A6F57;
  --teal-d: #1F5441;
  --blue: #C99D50;
  --blue-ce: #E8CE97;

  /* Luxury Bronze Borders & Shadows */
  --bw: 1px;
  --border: 1px solid rgba(201, 157, 80, 0.32);
  --border-2: 1px solid #304037;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(232, 206, 151, 0.25);

  /* Radius */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 26px;
  --r-full: 9999px;
}

/* ===== Reset ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  font-family: 'Be Vietnam Pro', 'Segoe UI', system-ui, -apple-system, sans-serif !important;
  background-color: var(--ink);
  background-image:
    radial-gradient(circle at 15% 0%, rgba(201, 157, 80, 0.10), transparent 36%),
    radial-gradient(circle at 85% 15%, rgba(61, 184, 120, 0.06), transparent 32%);
  color: var(--ivory);
  line-height: 1.55;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

ul {
  list-style: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  outline: none;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5 {
  font-family: 'Be Vietnam Pro', 'Segoe UI', sans-serif !important;
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -0.02em;
  color: var(--ivory);
}

h1 { font-size: clamp(2rem, 4.8vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.5rem); }
h3 { font-size: clamp(1.08rem, 2.2vw, 1.4rem); }

p {
  color: var(--muted);
  line-height: 1.68;
}

/* ===== Layout ===== */
.container {
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 24px;
}

.section { padding: 72px 0; }
.section-sm { padding: 44px 0; }

/* ===== Đông Sơn Ornamental Divider ===== */
.dong-son-divider {
  width: 100%;
  height: 22px;
  background: url('/assets/dong-son-border.svg') center / cover no-repeat;
  opacity: 0.78;
  border-top: 1px solid rgba(201, 157, 80, 0.2);
  border-bottom: 1px solid rgba(201, 157, 80, 0.2);
}

/* ===== NAVBAR (Đông Sơn Luxury Header) ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 72px;
  background: rgba(16, 26, 22, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(201, 157, 80, 0.28);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.navbar-brand img {
  height: 42px;
  width: auto;
}

.navbar-brand .brand-tag {
  background: linear-gradient(135deg, #EAD29B 0%, #C99D50 55%, #9B6E29 100%);
  color: #101A16;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: var(--r-full);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(24, 37, 31, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  padding: 4px;
}

.navbar-nav a {
  padding: 8px 18px;
  border-radius: var(--r-full);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  transition: all 0.2s;
}

.navbar-nav a:hover,
.navbar-nav a.active {
  background: linear-gradient(135deg, #E8CE97 0%, #C99D50 60%, #9E7330 100%);
  color: #101A16;
  font-weight: 700;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 10px;
  font-family: 'Be Vietnam Pro', sans-serif !important;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid rgba(201, 157, 80, 0.35);
  transition: all 0.18s ease;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn-pink,
.btn-yellow,
.btn-gold,
.btn-primary {
  background: linear-gradient(135deg, #EAD29B 0%, #C99D50 55%, #9B6E29 100%);
  color: #101A16 !important;
  border-color: #E8CE97;
  box-shadow: 0 8px 22px rgba(201, 157, 80, 0.25);
}

.btn-pink:hover,
.btn-yellow:hover,
.btn-gold:hover,
.btn-primary:hover {
  filter: brightness(1.06);
  box-shadow: 0 12px 28px rgba(201, 157, 80, 0.38);
}

.btn-teal {
  background: linear-gradient(135deg, #2D7A5E 0%, #1F5742 100%);
  color: var(--ivory) !important;
  border-color: rgba(232, 206, 151, 0.35);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.btn-teal:hover {
  background: linear-gradient(135deg, #358F6E 0%, #25684F 100%);
}

.btn-navy,
.btn-white {
  background: var(--surface-2);
  color: var(--light-gold) !important;
  border-color: rgba(201, 157, 80, 0.4);
}

.btn-outline {
  background: rgba(24, 37, 31, 0.75);
  color: var(--light-gold) !important;
  border: 1px solid rgba(201, 157, 80, 0.4);
}

.btn-outline:hover {
  background: rgba(201, 157, 80, 0.14);
  border-color: var(--light-gold);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 0.96rem;
}

.btn-sm {
  padding: 7px 15px;
  font-size: 0.78rem;
}

.btn-google {
  background: var(--surface);
  color: var(--ivory);
  border: 1px solid var(--line);
  border-radius: 10px;
}

/* ===== SECTION LABEL ===== */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(201, 157, 80, 0.14);
  color: var(--light-gold);
  border: 1px solid rgba(201, 157, 80, 0.38);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: var(--r-full);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 14px;
}

.section-label.yellow,
.section-label.pink,
.section-label.teal {
  background: rgba(201, 157, 80, 0.16);
  color: var(--light-gold);
}

/* ===== CARDS ===== */
.card-brut,
.doc-card {
  background: linear-gradient(180deg, rgba(28, 43, 36, 0.96), rgba(18, 29, 24, 0.98));
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
  position: relative;
}

.card-brut:hover,
.doc-card:hover {
  transform: translateY(-4px);
  border-color: var(--bronze);
  box-shadow: var(--shadow-lg);
}

.card-tape {
  display: none;
}

.doc-card-cover {
  aspect-ratio: 3/4;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #13201A;
  border-bottom: 1px solid var(--line);
}

.doc-card-body {
  padding: 15px;
}

.doc-card-category {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(201, 157, 80, 0.14);
  color: var(--light-gold);
  border: 1px solid rgba(201, 157, 80, 0.3);
  padding: 3px 10px;
  border-radius: var(--r-full);
  display: inline-block;
  margin-bottom: 8px;
}

.doc-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ivory);
  margin-bottom: 4px;
  line-height: 1.35;
}

.doc-card-author {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 10px;
}

.doc-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.doc-card-price {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--light-gold);
}

.doc-card-price.free {
  color: var(--success);
}

/* ===== BADGE ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  border: 1px solid rgba(201, 157, 80, 0.35);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-yellow, .badge-navy {
  background: rgba(201, 157, 80, 0.18);
  color: var(--light-gold);
}

.badge-pink {
  background: linear-gradient(135deg, #EAD29B, #C99D50);
  color: #101A16;
}

.badge-teal, .badge-green {
  background: rgba(61, 184, 120, 0.16);
  color: #6CE0A3;
  border-color: rgba(61, 184, 120, 0.35);
}

.badge-white {
  background: var(--surface-2);
  color: var(--ivory);
}

/* ===== SIDEBAR (App & Admin Layout) ===== */
.sidebar {
  width: 260px;
  min-height: 100vh;
  background: linear-gradient(180deg, #13201A 0%, #0E1713 100%);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-header img {
  height: 36px;
}

.sidebar-header .s-tag {
  background: linear-gradient(135deg, #EAD29B, #C99D50);
  color: #101A16;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--r-full);
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 14px 12px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  transition: all 0.18s;
  margin-bottom: 4px;
  border: 1px solid transparent;
}

.sidebar-nav a svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-nav a:hover {
  background: rgba(201, 157, 80, 0.08);
  color: var(--ivory);
  border-color: rgba(201, 157, 80, 0.2);
}

.sidebar-nav a.active {
  background: linear-gradient(135deg, rgba(201, 157, 80, 0.22), rgba(201, 157, 80, 0.08));
  color: var(--light-gold);
  border-color: rgba(201, 157, 80, 0.45);
  font-weight: 700;
}

.sidebar-nav .nav-label {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--bronze);
  padding: 14px 14px 6px;
  display: block;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ivory);
}

.sidebar-user-email {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 1px;
}

.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-main {
  margin-left: 260px;
  flex: 1;
  background: var(--ink);
}

.app-topbar {
  height: 64px;
  background: rgba(24, 37, 31, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.app-content {
  padding: 28px 24px;
}

/* ===== AVATAR ===== */
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #EAD29B, #C99D50);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #101A16;
  font-weight: 700;
  font-size: 0.88rem;
  overflow: hidden;
  border: 1px solid var(--light-gold);
  flex-shrink: 0;
}

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

/* ===== STAT CARD ===== */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid rgba(201, 157, 80, 0.35);
  background: rgba(201, 157, 80, 0.12);
  color: var(--light-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-value {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--light-gold);
  line-height: 1.1;
  margin-bottom: 2px;
}

.stat-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ===== TABS ===== */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  padding: 4px;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab-btn {
  padding: 8px 16px;
  border-radius: var(--r-full);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  background: transparent;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.tab-btn.active {
  background: linear-gradient(135deg, #EAD29B, #C99D50);
  color: #101A16;
  font-weight: 700;
}

/* ===== TOAST & MODAL ===== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  color: var(--ivory);
  border: 1px solid var(--bronze);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  min-width: 260px;
  font-size: 0.86rem;
  font-weight: 600;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(201, 157, 80, 0.2);
  border-top-color: var(--bronze);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 16, 13, 0.78);
  backdrop-filter: blur(6px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--bronze);
  border-radius: var(--r-lg);
  padding: 32px;
  max-width: 520px;
  width: 92%;
  box-shadow: var(--shadow-lg);
  color: var(--ivory);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--bronze); }

.progress-bar {
  height: 6px;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--bronze), var(--light-gold));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.form-input {
  width: 100%;
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  background: var(--ink);
  color: var(--ivory);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--bronze);
  box-shadow: 0 0 0 3px rgba(201, 157, 80, 0.16);
}

/* ===== GRID ===== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* ===== Book Detail Page ===== */
.book-detail-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

.bd-hero {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  background: var(--surface);
  border: 1px solid rgba(201, 157, 80, 0.35);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 22px;
  align-items: start;
}

.bd-cover img {
  width: 100%;
  border: 1px solid var(--bronze);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
}

.bd-meta h1 {
  font-size: clamp(1.4rem, 2.8vw, 2.1rem);
  font-weight: 700;
  color: var(--ivory);
  margin-bottom: 10px;
  line-height: 1.25;
}

.bd-meta-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 20px;
}

.bd-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
}

.bd-actions .btn,
.bd-download-slot .btn {
  width: 100%;
}

.bd-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 20px;
  margin-bottom: 20px;
  align-items: start;
}

.bd-toc-card,
.bd-video-card,
.bd-description-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: 22px;
}

.bd-toc-card h3,
.bd-video-card h3,
.bd-description-card h3 {
  font-size: 1.05rem;
  color: var(--light-gold);
  margin-bottom: 14px;
}

.bd-toc-tree {
  max-height: 480px;
  overflow-y: auto;
  font-size: 0.88rem;
}

.bd-toc-item {
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--ivory);
  transition: background 0.15s, color 0.15s;
}

.bd-toc-item:hover {
  background: rgba(201, 157, 80, 0.12);
  color: var(--light-gold);
}

.bd-toc-item.depth-0 { font-weight: 600; }
.bd-toc-item.depth-1 { padding-left: 22px; color: var(--muted); }
.bd-toc-item.depth-2 { padding-left: 34px; color: var(--muted); font-size: 0.83rem; }
.bd-toc-item.depth-3 { padding-left: 46px; color: var(--muted); font-size: 0.8rem; }

.bd-video-wrap {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}

.bd-video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.bd-description-card #bd-description {
  line-height: 1.8;
  white-space: pre-line;
  color: var(--ivory);
  opacity: 0.92;
}

.bd-download-slot {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ===== PREMIUM LOCK BADGE & PAYWALL MODAL (Đông Sơn 2.0) ===== */
.premium-lock-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #101A16;
  background: linear-gradient(135deg, #EAD29B, #C99D50);
  border: 1px solid #F6F0E4;
  border-radius: var(--r-full);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.premium-lock-badge.is-inline {
  position: static;
  font-size: 0.72rem;
  padding: 4px 11px;
}

.premium-paywall-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(10, 16, 13, 0.82);
  backdrop-filter: blur(8px);
}

.premium-paywall-overlay.active {
  display: flex;
}

.premium-paywall-modal {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 32px 28px 22px;
  text-align: center;
  color: var(--ivory);
  background: var(--surface);
  border: 1px solid var(--bronze);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}

.premium-paywall-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 32px;
  height: 32px;
  font-size: 1rem;
  color: var(--muted);
  background: none;
  border-radius: 50%;
}

.premium-paywall-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  background: rgba(201, 157, 80, 0.16);
  border: 1px solid var(--bronze);
  border-radius: 50%;
}

.premium-paywall-kicker {
  display: inline-block;
  margin-bottom: 10px;
  padding: 3px 12px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #101A16;
  background: linear-gradient(135deg, #EAD29B, #C99D50);
  border-radius: var(--r-full);
}

.premium-paywall-title {
  margin: 0 0 8px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ivory);
}

.premium-paywall-desc {
  margin: 0 0 16px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--light-gold);
}

.premium-paywall-benefits {
  list-style: none;
  margin: 0 0 20px;
  padding: 14px 16px;
  text-align: left;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.premium-paywall-benefits li {
  position: relative;
  padding: 5px 0 5px 28px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ivory);
}

.premium-paywall-benefits li::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 6px;
  width: 19px;
  height: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: #101A16;
  background: var(--bronze);
  border-radius: 50%;
}

.premium-paywall-primary {
  display: block;
  width: 100%;
  padding: 13px 16px;
  font-size: 0.92rem;
  font-weight: 700;
  text-align: center;
  color: #101A16;
  background: linear-gradient(135deg, #EAD29B, #C99D50);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(201, 157, 80, 0.3);
}

.premium-paywall-vip {
  display: inline-block;
  margin-top: 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--light-gold);
  text-decoration: underline;
}

.premium-paywall-later {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  font-size: 0.84rem;
  color: var(--muted);
  background: none;
}

.bd-premium-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: -2px 0 12px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--light-gold);
}

.bd-toc-item.is-locked {
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.55;
}

.bd-toc-item.is-locked .bd-toc-lock {
  margin-left: auto;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .bd-hero { grid-template-columns: 1fr; }
  .bd-cover img { max-width: 200px; margin: 0 auto; }
  .bd-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .navbar { height: 60px; padding: 0 14px; }
  .navbar-nav { display: none !important; }
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .app-main { margin-left: 0; }
}
