/* ================================================================
   AFROLIVI - Desktop Layout System
   Colors: brand #5a3301 | bg #faf3ea | gold #d0892d | amber #ffb323
   ================================================================ */

:root {
  --brand:      #5a3301;
  --brand-h:    #7a4d1a;
  --brand-deep: #3d1f00;
  --bg:         #faf3ea;
  --gold:       #d0892d;
  --gold-lt:    #e4bb85;
  --amber:      #ffb323;
  --text:       #2d1a00;
  --muted:      #6b5a48;
  --border:     #e8ddd0;
  --white:      #ffffff;
  --sidebar-w:  260px;
  --topbar-h:   68px;
  --r:          12px;
}

/* ── Reset overrides ────────────────────────────────────────── */
/* Kill the 430px PWA cap on desktop layout pages */
.desktop-page .container,
.desktop-page main.container {
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Prevent horizontal overflow on ALL screens */
.main-area, .page-body { overflow-x: hidden; }

/* Safe auto-fill grids — never overflow viewport width */
.books-grid  { grid-template-columns: repeat(auto-fill, minmax(min(100%, 148px), 1fr)); }
.videos-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.reading-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.cat-grid    { grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); }

/* Kill the over-eager transition on every element */
* { box-sizing: border-box; }
img { transition: transform 0.3s ease, opacity 0.3s ease !important; }

/* ── App shell ──────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--brand);
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-logo {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-shrink: 0;
}
.sidebar-logo img { height: 36px; width: auto; }
.sidebar-logo .brand-name {
  color: #fff;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: .5px;
  white-space: nowrap;
}

.sidebar-nav { flex: 1; padding: 1rem 0; }

.sidebar-section {
  padding: .5rem 1.5rem .25rem;
  color: rgba(255,255,255,.35);
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  font-weight: 700;
  margin-top: .5rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem 1.5rem;
  color: rgba(255,255,255,.65);
  font-size: .9rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, color .15s;
  position: relative;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
}
.sidebar-link i { font-size: 1.2rem; width: 1.4rem; text-align: center; flex-shrink: 0; }
.sidebar-link:hover { background: rgba(255,255,255,.08); color: #fff; opacity: 1; transform: none; }
.sidebar-link.active {
  background: rgba(255,179,35,.12);
  color: var(--amber);
  border-left: 3px solid var(--amber);
}
.sidebar-link.active i { color: var(--amber); }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem .75rem;
  border-radius: 10px;
  background: rgba(255,255,255,.07);
  cursor: pointer;
  transition: background .2s;
  text-decoration: none;
}
.sidebar-user:hover { background: rgba(255,255,255,.13); opacity: 1; transform: none; }
.sidebar-user img {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.25);
}
.sidebar-user-name { color: #fff; font-weight: 600; font-size: .85rem; }
.sidebar-user-sub  { color: rgba(255,255,255,.45); font-size: .72rem; }

/* Overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 90;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

/* ── Main area ──────────────────────────────────────────────── */
.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  padding: 0 1.75rem;
  gap: 1rem;
  box-shadow: 0 1px 4px rgba(90,51,1,.06);
  flex-shrink: 0;
}

.topbar-toggle {
  display: none;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--white);
  font-size: 1.2rem;
  color: var(--brand);
  flex-shrink: 0;
}

.topbar-search {
  flex: 1;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: .5rem 1.1rem;
  transition: border-color .2s, box-shadow .2s;
  text-decoration: none;
}
.topbar-search:hover,
.topbar-search:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(208,137,45,.1);
  opacity: 1;
  transform: none;
}
.topbar-search i { color: var(--muted); font-size: 1rem; flex-shrink: 0; }
.topbar-search input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: .875rem;
  color: var(--text);
}
.topbar-search input::placeholder { color: var(--muted); }

.topbar-spacer { flex: 1; }

.topbar-actions { display: flex; align-items: center; gap: .6rem; }

.topbar-icon-btn {
  position: relative;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.topbar-icon-btn:hover { background: var(--bg); border-color: var(--gold); color: var(--brand); opacity: 1; transform: none; }
.topbar-notif-dot {
  position: absolute;
  top: 0; right: 0;
  width: 9px; height: 9px;
  background: var(--amber);
  border-radius: 50%;
  border: 2px solid var(--white);
}

.topbar-avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--gold-lt);
  cursor: pointer;
  transition: border-color .2s;
  flex-shrink: 0;
  text-decoration: none;
  display: block;
}
.topbar-avatar:hover { border-color: var(--gold); opacity: 1; transform: none; }
.topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Page content ───────────────────────────────────────────── */
.page-body {
  padding: 2rem 2rem 2.5rem;
  flex: 1;
}

.page-head { margin-bottom: 1.75rem; }
.page-head h1 { font-size: 1.65rem; font-weight: 800; color: var(--brand); }
.page-head p  { color: var(--muted); font-size: .9rem; margin-top: .2rem; }

/* ── Section ────────────────────────────────────────────────── */
.section { margin-bottom: 2.5rem; }
.section-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.1rem;
}
.section-hd h2 { font-size: 1.05rem; font-weight: 700; color: var(--brand); }
.section-hd a  {
  font-size: .8rem;
  color: var(--gold);
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .25rem;
  transition: opacity .2s;
}
.section-hd a:hover { opacity: .75; transform: none; }

/* ── Hero Banner ────────────────────────────────────────────── */
.hero-banner {
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand) 0%, #8B4513 60%, #3d1f00 100%);
  padding: 2rem 2.5rem;
  color: #fff;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  overflow: hidden;
  position: relative;
}
.hero-banner::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  right: -80px; top: -80px;
}
.hero-banner h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: .4rem; }
.hero-banner p  { opacity: .75; font-size: .9rem; margin-bottom: 1.25rem; }
.hero-banner .btn-amber {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--amber);
  color: var(--brand-deep);
  font-weight: 700;
  font-size: .875rem;
  padding: .6rem 1.25rem;
  border-radius: 50px;
  text-decoration: none;
  transition: transform .2s, box-shadow .2s;
}
.hero-banner .btn-amber:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255,179,35,.4);
  opacity: 1;
}
.hero-banner-books {
  display: flex;
  gap: .75rem;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}
.hero-banner-books img {
  height: 120px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.hero-banner-books img:nth-child(1) { transform: rotate(-6deg) translateY(4px); }
.hero-banner-books img:nth-child(2) { transform: rotate(0deg); }
.hero-banner-books img:nth-child(3) { transform: rotate(6deg) translateY(4px); }

/* ── Stats row ──────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--white);
  border-radius: var(--r);
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .875rem;
  border: 1px solid var(--border);
  transition: box-shadow .2s;
}
.stat-card:hover { box-shadow: 0 4px 16px rgba(90,51,1,.08); transform: none; }
.stat-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-icon.gold  { background: rgba(208,137,45,.1);  color: var(--gold);  }
.stat-icon.brand { background: rgba(90,51,1,.1);     color: var(--brand); }
.stat-icon.amber { background: rgba(255,179,35,.12); color: var(--amber); }
.stat-val  { font-size: 1.3rem; font-weight: 800; color: var(--brand); }
.stat-lbl  { font-size: .75rem; color: var(--muted); }

/* ── Books grid ─────────────────────────────────────────────── */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 1.1rem;
}

.book-card {
  background: var(--white);
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid transparent;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform .25s, box-shadow .25s, border-color .25s;
  position: relative;
}
.book-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 32px rgba(90,51,1,.14);
  border-color: var(--gold-lt);
  opacity: 1;
}
.book-card-img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  display: block;
}
.book-card-body { padding: .75rem; }
.book-card-title {
  font-size: .85rem;
  font-weight: 700;
  color: var(--brand);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: .2rem;
}
.book-card-author { font-size: .72rem; color: var(--muted); }
.book-card-badge {
  position: absolute;
  top: .5rem;
  right: .5rem;
  width: 1.75rem;
  height: 1.75rem;
  background: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  font-size: .9rem;
}
.book-card-rating {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  padding: .5rem;
  font-size: .75rem;
  color: #fff;
}

/* Book list (compact row) */
.book-row {
  background: var(--white);
  border-radius: var(--r);
  border: 1px solid var(--border);
  padding: .875rem 1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .2s, border-color .2s;
}
.book-row:hover { box-shadow: 0 4px 16px rgba(90,51,1,.1); border-color: var(--gold-lt); transform: none; opacity: 1; }
.book-row-cover {
  width: 4rem;
  height: 5.5rem;
  object-fit: cover;
  border-radius: 7px;
  flex-shrink: 0;
}
.book-row-title { font-size: .9rem; font-weight: 700; color: var(--brand); margin-bottom: .2rem; }
.book-row-author { font-size: .75rem; color: var(--gold); font-weight: 600; }
.book-row-desc {
  font-size: .78rem;
  color: var(--muted);
  margin-top: .35rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Videos grid ────────────────────────────────────────────── */
.videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.1rem;
}

.video-card {
  background: var(--white);
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid transparent;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform .25s, box-shadow .25s, border-color .25s;
}
.video-card:hover { transform: translateY(-4px); box-shadow: 0 10px 28px rgba(90,51,1,.13); border-color: var(--gold-lt); opacity: 1; }
.video-thumb {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
}
.video-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.video-card:hover .video-thumb img { transform: scale(1.06); }
.video-play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .25s;
}
.video-card:hover .video-play-overlay { opacity: 1; }
.video-play-btn {
  width: 3.5rem;
  height: 3.5rem;
  background: rgba(90,51,1,.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.5rem;
}
.video-card-body { padding: .875rem; }
.video-card-title { font-size: .9rem; font-weight: 700; color: var(--brand); margin-bottom: .25rem; }
.video-card-author { font-size: .75rem; color: var(--muted); }
.video-featured-label {
  position: absolute;
  top: .6rem; left: .6rem;
  background: var(--brand);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  padding: .2rem .6rem;
  border-radius: 50px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ── Reading progress cards ─────────────────────────────────── */
.reading-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}
.reading-card {
  background: var(--white);
  border-radius: var(--r);
  border: 1px solid var(--border);
  padding: 1rem;
  display: flex;
  gap: 1rem;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .2s, border-color .2s;
}
.reading-card:hover { box-shadow: 0 6px 20px rgba(90,51,1,.1); border-color: var(--gold-lt); transform: none; opacity: 1; }
.reading-cover { width: 4rem; height: 5.5rem; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.reading-title  { font-size: .9rem; font-weight: 700; color: var(--brand); }
.reading-author { font-size: .75rem; color: var(--gold); font-weight: 600; margin-top: .15rem; }
.reading-pages  { font-size: .72rem; color: var(--muted); margin-top: .25rem; }
.progress-track { height: 5px; background: var(--bg); border-radius: 3px; overflow: hidden; margin-top: .5rem; }
.progress-fill  { height: 100%; background: var(--brand); border-radius: 3px; }
.reading-pct    { font-size: .72rem; font-weight: 700; color: var(--brand); }
.btn-read {
  font-size: .75rem;
  font-weight: 700;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: .35rem .8rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: opacity .2s;
}
.btn-read:hover { opacity: .85; transform: none; }

/* ── Category pills ─────────────────────────────────────────── */
.cat-pills {
  display: flex;
  gap: .65rem;
  overflow-x: auto;
  padding-bottom: .25rem;
  scrollbar-width: none;
}
.cat-pills::-webkit-scrollbar { display: none; }
.cat-pill {
  flex-shrink: 0;
  padding: .45rem 1.1rem;
  border-radius: 50px;
  font-size: .82rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s;
  display: block;
}
.cat-pill:hover, .cat-pill.active {
  background: var(--brand);
  color: var(--white);
  border-color: var(--brand);
  opacity: 1;
  transform: none;
}

/* Category grid cards */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}
.cat-card {
  border-radius: var(--r);
  overflow: hidden;
  position: relative;
  display: block;
  aspect-ratio: 16/9;
  text-decoration: none;
  transition: transform .25s;
}
.cat-card:hover { transform: scale(1.03); opacity: 1; }
.cat-card img { width: 100%; height: 100%; object-fit: cover; }
.cat-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.7) 0%, transparent 60%);
  display: flex;
  align-items: flex-end;
  padding: .75rem;
}
.cat-card-name  { color: #fff; font-weight: 700; font-size: .85rem; }
.cat-card-count { color: rgba(255,255,255,.7); font-size: .7rem; }

/* ── Mobile bottom nav ──────────────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--brand);
  padding: .6rem 1.25rem .75rem;
  z-index: 100;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -4px 20px rgba(90,51,1,.25);
}
.bottom-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 480px;
  margin: 0 auto;
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
  color: rgba(255,255,255,.6);
  font-size: .62rem;
  font-weight: 700;
  text-decoration: none;
  padding: .2rem .5rem;
  transition: color .15s;
}
.bottom-nav a i { font-size: 1.4rem; }
.bottom-nav a.active { color: var(--amber); }
.bottom-nav a:hover { opacity: 1; color: #fff; }

/* ── Auth pages ─────────────────────────────────────────────── */
.auth-wrap {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.auth-hero {
  flex: 0 0 42%;
  background: linear-gradient(150deg, var(--brand) 0%, #8B4513 55%, var(--brand-deep) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2.5rem;
  position: relative;
  overflow: hidden;
}
.auth-hero::before {
  content: '';
  position: absolute;
  width: 480px; height: 480px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  top: -150px; right: -150px;
}
.auth-hero::after {
  content: '';
  position: absolute;
  width: 320px; height: 320px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  bottom: -100px; left: -100px;
}
.auth-hero-content { position: relative; z-index: 1; text-align: center; }
.auth-hero-logo { height: 72px; margin-bottom: 1.75rem; }
.auth-hero h2 { color: #fff; font-size: 2rem; font-weight: 800; line-height: 1.2; margin-bottom: .75rem; }
.auth-hero p  { color: rgba(255,255,255,.7); font-size: .9rem; line-height: 1.6; max-width: 300px; }

.auth-book-strip {
  display: flex;
  gap: .75rem;
  margin-top: 2.5rem;
  justify-content: center;
}
.auth-book-strip img {
  height: 130px;
  border-radius: 9px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.auth-book-strip img:nth-child(1) { transform: rotate(-6deg) translateY(6px); }
.auth-book-strip img:nth-child(3) { transform: rotate(6deg) translateY(6px); }

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: rgba(255,179,35,.15);
  border: 1px solid rgba(255,179,35,.3);
  color: var(--amber);
  font-size: .78rem;
  font-weight: 600;
  padding: .35rem .9rem;
  border-radius: 50px;
  margin-bottom: 1.5rem;
}

.auth-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2.5rem;
}

.auth-box { width: 100%; max-width: 420px; }
.auth-box h1 { font-size: 1.75rem; font-weight: 800; color: var(--brand); margin-bottom: .35rem; }
.auth-box .auth-sub { color: var(--muted); font-size: .875rem; margin-bottom: 2rem; }

.auth-box .form-field { margin-bottom: 1.1rem; }
.auth-box .form-label {
  display: block;
  font-weight: 600;
  font-size: .825rem;
  color: var(--brand);
  margin-bottom: .4rem;
}
.auth-box .input-wrap { position: relative; display: flex; align-items: center; }
.auth-box .input-icon { position: absolute; left: .9rem; color: var(--muted); font-size: 1rem; pointer-events: none; }
.auth-box .form-input {
  width: 100%;
  padding: .8rem 1rem .8rem 2.5rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: .9rem;
  background: var(--white);
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.auth-box .form-input.no-icon { padding-left: 1rem; }
.auth-box .form-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(90,51,1,.08);
  transform: none;
}
.auth-box .input-eye {
  position: absolute;
  right: .9rem;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  transition: color .2s;
}
.auth-box .input-eye:hover { color: var(--brand); }

.btn-auth {
  width: 100%;
  padding: .875rem;
  background: var(--brand);
  color: var(--white);
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s, transform .2s, box-shadow .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin-top: .5rem;
}
.btn-auth:hover {
  background: var(--brand-h);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(90,51,1,.25);
}
.btn-auth:active { transform: translateY(0); }

.auth-link-row {
  text-align: center;
  margin-top: 1.5rem;
  font-size: .875rem;
  color: var(--muted);
}
.auth-link-row a { color: var(--brand); font-weight: 700; text-decoration: none; }
.auth-link-row a:hover { text-decoration: underline; }

.creator-cta {
  display: flex;
  align-items: center;
  gap: .9rem;
  margin-top: 1.75rem;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(208,137,45,.1) 0%, rgba(90,51,1,.06) 100%);
  border: 1px solid var(--gold-lt);
  text-decoration: none;
  transition: box-shadow .2s, transform .2s;
}
.creator-cta:hover { box-shadow: 0 6px 18px rgba(90,51,1,.12); transform: translateY(-1px); }
.creator-cta-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  color: var(--amber);
  font-size: 1.2rem;
}
.creator-cta-text { display: flex; flex-direction: column; flex: 1; }
.creator-cta-text strong { color: var(--brand); font-size: .9rem; }
.creator-cta-text span { color: var(--muted); font-size: .78rem; }
.creator-cta-arrow { color: var(--gold); font-size: 1.1rem; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1.25rem 0;
  color: var(--muted);
  font-size: .8rem;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.strength-bar-wrap { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: .5rem; }
.strength-bar { height: 100%; border-radius: 2px; transition: width .3s, background .3s; width: 0; }
.strength-bar.weak   { background: #e53e3e; width: 33%; }
.strength-bar.medium { background: var(--gold); width: 66%; }
.strength-bar.strong { background: #38a169; width: 100%; }
.strength-text { font-size: .72rem; color: var(--muted); text-align: right; margin-top: .25rem; }

.alert {
  padding: .75rem 1rem;
  border-radius: 8px;
  font-size: .85rem;
  margin-bottom: 1rem;
  border-left: 4px solid;
  display: none;
}
.alert.error  { background: rgba(229,62,62,.08); border-color: #e53e3e; color: #c53030; }
.alert.success { background: rgba(56,161,105,.08); border-color: #38a169; color: #276749; }

/* ── Settings layout ────────────────────────────────────────── */
.profile-hero {
  background: var(--brand);
  border-radius: 16px;
  padding: 1.75rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.profile-hero img { width: 5rem; height: 5rem; border-radius: 50%; border: 3px solid rgba(255,255,255,.3); object-fit: cover; }
.profile-hero-name { color: #fff; font-size: 1.2rem; font-weight: 700; }
.profile-hero-email { color: rgba(255,255,255,.6); font-size: .85rem; }
.profile-edit-btn {
  margin-left: auto;
  width: 2.75rem;
  height: 2.75rem;
  background: rgba(255,255,255,.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
  text-decoration: none;
  transition: background .2s;
}
.profile-edit-btn:hover { background: rgba(255,255,255,.2); opacity: 1; transform: none; }

.settings-card {
  background: var(--white);
  border-radius: var(--r);
  border: 1px solid var(--border);
  overflow: hidden;
}
.settings-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px dashed var(--border);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background .15s;
}
.settings-item:last-child { border-bottom: none; }
.settings-item:hover { background: var(--bg); opacity: 1; transform: none; }
.settings-item-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  background: rgba(208,137,45,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: var(--gold);
  flex-shrink: 0;
}
.settings-item-label { font-size: .925rem; font-weight: 600; color: var(--brand); flex: 1; }
.settings-item-arrow { color: var(--muted); font-size: 1rem; }

.dark-toggle {
  height: 1.5rem;
  width: 2.75rem;
  border-radius: 50px;
  background: var(--border);
  position: relative;
  transition: background .3s;
  flex-shrink: 0;
  cursor: pointer;
}
.dark-toggle.on { background: var(--brand); }
.dark-toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  background: #fff;
  transition: left .3s;
}
.dark-toggle.on .dark-toggle-thumb { left: calc(100% - 1.125rem - 2px); }

/* ── Responsive ─────────────────────────────────────────────── */

/* ── Content/text page utilities ────────────────────────────── */
.prose-page { max-width: 820px; }
.prose-page p     { font-size: .9rem; color: var(--muted); line-height: 1.8; margin-bottom: 1rem; }
.prose-page h3    { font-size: 1rem; font-weight: 700; color: var(--brand); margin: 1.75rem 0 .6rem; }
.prose-page ul    { padding-left: 1.25rem; margin-bottom: 1rem; }
.prose-page ul li { font-size: .9rem; color: var(--muted); line-height: 1.8; margin-bottom: .35rem; }

/* ── Touch: improve tap targets */
@media (hover: none) {
  .sidebar-link,
  .settings-item,
  .book-card,
  .video-card,
  .book-row,
  .reading-card { -webkit-tap-highlight-color: rgba(90,51,1,.08); }
  button, a { touch-action: manipulation; }
}

/* ── Tablet ≤1024px ── */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: 8px 0 32px rgba(0,0,0,.2); }
  .main-area { margin-left: 0; }
  .topbar-toggle { display: flex; }
  .bottom-nav { display: block; }
  .page-body { padding: 1.25rem 1rem 5.5rem; }
  .hero-banner-books { display: none; }
  .auth-hero { display: none; }
  .auth-side { padding: 2.5rem 2rem; }
  .auth-wrap { min-height: 100vh; align-items: flex-start; }
  .auth-side { min-height: 100vh; }
  .videos-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .books-grid  { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .stats-row   { grid-template-columns: repeat(3, 1fr); }
  .reading-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  /* Topbar: hide actions label text, keep icons */
  .topbar-search { max-width: 360px; }
}

/* ── Large mobile ≤768px ── */
@media (max-width: 768px) {
  .page-head h1   { font-size: 1.4rem; }
  .page-head p    { font-size: .82rem; }
  .stats-row      { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
  .cat-grid       { grid-template-columns: repeat(2, 1fr); gap: .65rem; }
  .reading-grid   { grid-template-columns: 1fr; }
  .videos-grid    { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
  .hero-banner    { padding: 1.5rem; border-radius: 14px; }
  .hero-banner h2 { font-size: 1.25rem; }
  .hero-banner p  { font-size: .82rem; margin-bottom: .9rem; }
  .profile-hero   { padding: 1.25rem; gap: .875rem; }
  .profile-hero img { width: 4rem; height: 4rem; }
  .profile-hero-name { font-size: 1rem; }
  /* book details: stack the 2-col grid */
  .book-detail-grid { grid-template-columns: 1fr !important; }
  .book-detail-cover { margin: 0 auto; max-width: 220px; }
  .topbar-search  { max-width: 260px; }
  /* FAQ / content pages */
  .content-two-col { grid-template-columns: 1fr !important; }
}

/* ── Small mobile ≤480px ── */
@media (max-width: 480px) {
  .topbar        { padding: 0 .75rem; gap: .5rem; height: 60px; }
  .topbar-search { display: none; }
  .topbar-search-mobile { display: flex !important; }  /* shown by topbar.php */
  .topbar-actions { gap: .35rem; }
  .topbar-icon-btn, .topbar-toggle { width: 2rem; height: 2rem; font-size: 1rem; }
  .topbar-avatar  { width: 2rem; height: 2rem; }

  .page-body { padding: .875rem .75rem 5.5rem; }
  .page-head  { margin-bottom: 1.25rem; }
  .page-head h1 { font-size: 1.2rem; }

  .books-grid   { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
  .book-card-body { padding: .5rem; }
  .book-card-title { font-size: .78rem; }
  .book-card-author { font-size: .65rem; }

  .videos-grid  { grid-template-columns: 1fr; }
  .stats-row    { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
  .stat-card    { padding: .85rem; gap: .6rem; }
  .stat-icon    { width: 2.25rem; height: 2.25rem; font-size: 1.1rem; border-radius: 8px; }
  .stat-val     { font-size: 1.1rem; }

  .section      { margin-bottom: 1.75rem; }
  .section-hd h2 { font-size: .9rem; }
  .section-hd a  { font-size: .75rem; }

  .hero-banner  { border-radius: 12px; padding: 1.1rem 1.25rem; }
  .hero-banner h2 { font-size: 1rem; margin-bottom: .3rem; }
  .hero-banner p  { font-size: .78rem; margin-bottom: .75rem; }
  .hero-banner .btn-amber { font-size: .78rem; padding: .5rem 1rem; }

  .cat-grid     { grid-template-columns: repeat(2, 1fr); gap: .5rem; }
  .cat-pill     { padding: .38rem .85rem; font-size: .78rem; }

  .reading-grid { grid-template-columns: 1fr; }
  .reading-card { padding: .75rem; gap: .75rem; }
  .reading-cover { width: 3.25rem; height: 4.5rem; }

  .book-row-cover { width: 3rem; height: 4rem; }
  .book-row       { padding: .65rem .75rem; gap: .75rem; }
  .book-row-title { font-size: .82rem; }
  .book-row-desc  { display: none; }

  .auth-side    { padding: 1.5rem 1rem; align-items: flex-start; }
  .auth-box h1  { font-size: 1.4rem; }
  .auth-box .auth-sub { font-size: .82rem; margin-bottom: 1.5rem; }
  .auth-box .form-input { padding: .75rem 1rem .75rem 2.25rem; font-size: .875rem; }

  .profile-hero { flex-wrap: wrap; border-radius: 14px; }
  .profile-edit-btn { margin-left: auto; }
  .settings-item { padding: .9rem 1rem; }
  .settings-item-icon { width: 2.1rem; height: 2.1rem; font-size: 1rem; }
  .settings-item-label { font-size: .85rem; }

  .bottom-nav   { padding: .5rem 1rem .65rem; border-radius: 16px 16px 0 0; }
  .bottom-nav a { font-size: .58rem; padding: .15rem .3rem; }
  .bottom-nav a i { font-size: 1.3rem; }

  /* Help center / text pages */
  .faq-item { padding: .875rem !important; }
  .contact-grid { grid-template-columns: 1fr !important; }
}
