/* ============================================================
   ATEN Digital Library — Stylesheet
   Palette: Deep navy #0f1923 / Teal accent #1a6b5a / Warm cream text
   Typography: Playfair Display (headings) + DM Sans (body)
   ============================================================ */

:root {
  --navy:        #0f1923;
  --navy-2:      #1a2836;
  --navy-3:      #243444;
  --navy-4:      #2d3f50;
  --teal:        #1a6b5a;
  --teal-dark:   #145748;
  --teal-light:  #e8f5f1;
  --teal-mid:    #c8e6df;
  --gold:        #c9a84c;
  --text:        #1c2b24;
  --text-muted:  #6b7c74;
  --text-light:  #9ab0a8;
  --bg:          #f5f2ec;
  --bg-card:     #ffffff;
  --border:      #e0dbd0;
  --border-dark: #c8c0b0;
  --danger:      #c0392b;
  --success:     #1a6b5a;
  --radius:      10px;
  --radius-lg:   16px;
  --shadow-sm:   0 1px 4px rgba(0,0,0,.06);
  --shadow:      0 2px 16px rgba(0,0,0,.08);
  --shadow-lg:   0 8px 40px rgba(0,0,0,.14);
  --font-display:'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body:   'DM Sans', 'Segoe UI', system-ui, sans-serif;
  --navbar-h:    64px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal); text-decoration: none; transition: color .15s; }
a:hover { color: var(--teal-dark); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: var(--font-body); }

/* ── Navbar ───────────────────────────────────────────────── */
.navbar {
  background: var(--navy);
  height: var(--navbar-h);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 200;
  gap: 2rem;
  box-shadow: 0 2px 20px rgba(0,0,0,.3);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: .01em;
}
.navbar-brand:hover { color: var(--teal-mid); }
.brand-abbr {
  background: var(--teal);
  color: #fff;
  font-family: var(--font-display);
  font-size: .9rem;
  font-weight: 700;
  padding: .2rem .5rem;
  border-radius: 5px;
  letter-spacing: .04em;
}
.brand-text { color: #e0eeea; }

.navbar-search {
  flex: 1;
  max-width: 380px;
  position: relative;
}
.navbar-search input {
  width: 100%;
  background: var(--navy-3);
  border: 1px solid var(--navy-4);
  color: #e0eeea;
  padding: .5rem 1rem .5rem 2.4rem;
  border-radius: 20px;
  font-size: .88rem;
  transition: border-color .2s, background .2s;
}
.navbar-search input::placeholder { color: #5a7870; }
.navbar-search input:focus { outline: none; border-color: var(--teal); background: var(--navy-2); }
.navbar-search .search-icon {
  position: absolute;
  left: .85rem;
  top: 50%;
  transform: translateY(-50%);
  color: #5a7870;
  font-size: .9rem;
  pointer-events: none;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: .2rem;
  margin-left: auto;
}
.navbar-nav a {
  color: #9ab8b0;
  font-size: .88rem;
  font-weight: 400;
  padding: .4rem .8rem;
  border-radius: 6px;
  transition: color .15s, background .15s;
  white-space: nowrap;
}
.navbar-nav a:hover, .navbar-nav a.active { color: #fff; background: var(--navy-3); }

.nav-divider { width: 1px; height: 20px; background: var(--navy-4); margin: 0 .4rem; }

.btn-nav-signin {
  background: var(--teal) !important;
  color: #fff !important;
  padding: .4rem 1rem !important;
  border-radius: 20px !important;
  font-weight: 500 !important;
}
.btn-nav-signin:hover { background: var(--teal-dark) !important; }

.nav-user {
  display: flex;
  align-items: center;
  gap: .6rem;
}
.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Page wrapper ─────────────────────────────────────────── */
.page-wrap {
  flex: 1;
  max-width: 1300px;
  margin: 0 auto;
  width: 100%;
  padding: 2.5rem 1.5rem;
}
.page-wrap.full { max-width: 100%; padding: 0; }

/* ── Flash messages ───────────────────────────────────────── */
.flash {
  padding: .85rem 1.2rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: .9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.flash-success { background: #d4f4e8; color: #0d5c3a; border-left: 4px solid var(--teal); }
.flash-error   { background: #fde8e8; color: #7b1c1c; border-left: 4px solid var(--danger); }

/* ── Hero ─────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, #162535 50%, #1a3028 100%);
  color: #fff;
  padding: 4.5rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%231a6b5a' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: rgba(26,107,90,.3);
  border: 1px solid rgba(26,107,90,.5);
  color: var(--teal-mid);
  font-size: .78rem;
  font-weight: 600;
  padding: .3rem .9rem;
  border-radius: 20px;
  margin-bottom: 1.5rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: #fff;
}
.hero h1 em { color: var(--teal-mid); font-style: normal; }
.hero p {
  color: #8fb8b0;
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0 auto 2rem;
}
.hero-search {
  display: flex;
  max-width: 540px;
  margin: 0 auto 1.5rem;
  background: #fff;
  border-radius: 50px;
  overflow: hidden;
  box-shadow: 0 4px 30px rgba(0,0,0,.2);
}
.hero-search input {
  flex: 1;
  border: none;
  padding: .9rem 1.4rem;
  font-size: .95rem;
  color: var(--text);
  background: transparent;
}
.hero-search input:focus { outline: none; }
.hero-search button {
  background: var(--teal);
  color: #fff;
  border: none;
  padding: .9rem 1.6rem;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}
.hero-search button:hover { background: var(--teal-dark); }
.hero-tags { color: #5a7870; font-size: .82rem; }
.hero-tags a { color: #8fb8b0; font-weight: 500; margin: 0 .2rem; }
.hero-tags a:hover { color: #fff; }

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}
.hero-stat { text-align: center; }
.hero-stat-num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}
.hero-stat-label { font-size: .78rem; color: #5a7870; margin-top: .3rem; text-transform: uppercase; letter-spacing: .06em; }

/* ── Section headings ─────────────────────────────────────── */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}
.section-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--teal);
  margin-bottom: .3rem;
}
.section-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.section-link {
  font-size: .85rem;
  font-weight: 500;
  color: var(--teal);
  white-space: nowrap;
  flex-shrink: 0;
}
.section-link:hover { color: var(--teal-dark); }

/* ── Book cards ───────────────────────────────────────────── */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1.5rem;
}

.book-card {
  display: block;
  color: inherit;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s;
  position: relative;
}
.book-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  color: inherit;
}

.book-cover-wrap {
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: linear-gradient(160deg, var(--navy) 0%, #1a3028 100%);
  position: relative;
}
.book-cover-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s;
}
.book-card:hover .book-cover-wrap img { transform: scale(1.04); }

.book-cover-placeholder {
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  gap: .6rem;
}
.cover-icon { font-size: 2.8rem; opacity: .5; }
.cover-title-text {
  font-family: var(--font-display);
  font-size: .78rem;
  color: var(--teal-mid);
  text-align: center;
  line-height: 1.3;
  opacity: .85;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cover-author-text { font-size: .7rem; color: #4a6a62; text-align: center; }

.book-info { padding: .85rem .9rem; }
.book-title {
  font-family: var(--font-display);
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: .25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text);
}
.book-author { font-size: .78rem; color: var(--text-muted); margin-bottom: .5rem; }
.book-cat-badge {
  display: inline-block;
  background: var(--teal-light);
  color: var(--teal);
  font-size: .68rem;
  font-weight: 700;
  padding: .15rem .55rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ── Categories grid ──────────────────────────────────────── */
.cats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.cat-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all .2s;
  color: var(--text);
}
.cat-card:hover {
  background: var(--teal-light);
  border-color: var(--teal-mid);
  color: var(--teal-dark);
  transform: translateX(3px);
}
.cat-name { font-weight: 500; font-size: .9rem; }
.cat-count { font-size: .78rem; color: var(--text-muted); }
.cat-card:hover .cat-count { color: var(--teal); }

/* ── Categories page list ─────────────────────────────────── */
.cats-list { display: flex; flex-direction: column; gap: 0; }
.cat-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 1.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  margin-bottom: -1px;
  text-decoration: none;
  color: var(--text);
  transition: background .15s, color .15s;
}
.cat-row:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.cat-row:last-child  { border-radius: 0 0 var(--radius) var(--radius); margin-bottom: 0; }
.cat-row:hover { background: var(--teal-light); color: var(--teal-dark); z-index: 1; position: relative; }
.cat-num { font-size: .8rem; color: var(--text-muted); font-weight: 600; width: 28px; text-align: right; }
.cat-row-name { flex: 1; font-weight: 500; }
.cat-row-count { font-size: .82rem; color: var(--text-muted); }

/* ── Featured book of the month ───────────────────────────── */
.featured-month {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow);
  align-items: start;
}
.featured-month .book-cover-wrap { border-radius: 10px; box-shadow: var(--shadow-lg); }
.featured-month-badge {
  display: inline-block;
  background: var(--teal);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  padding: .2rem .7rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: .8rem;
}
.featured-month h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: .4rem;
}
.featured-month .by { color: var(--text-muted); font-size: .9rem; margin-bottom: 1rem; }
.featured-month p   { font-size: .92rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 1.5rem; }

/* ── Faculty recs ─────────────────────────────────────────── */
.faculty-list { list-style: none; display: flex; flex-direction: column; gap: 0; }
.faculty-item {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: .8rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: color .15s;
}
.faculty-item:last-child { border-bottom: none; }
.faculty-item:hover { color: var(--teal); }
.faculty-item-cat {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--teal);
  flex-shrink: 0;
  width: 120px;
}
.faculty-item-title { flex: 1; font-weight: 500; font-size: .9rem; }
.faculty-item-author { font-size: .8rem; color: var(--text-muted); }

/* ── Browse page layout ───────────────────────────────────── */
.browse-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
  align-items: start;
}
.browse-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: sticky;
  top: calc(var(--navbar-h) + 1.5rem);
}
.sidebar-title {
  background: var(--navy);
  color: #c8d8d4;
  padding: .85rem 1.2rem;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.sidebar-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .65rem 1.2rem;
  font-size: .88rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
  color: var(--text);
  text-decoration: none;
}
.sidebar-item:last-child { border-bottom: none; }
.sidebar-item:hover, .sidebar-item.active {
  background: var(--teal-light);
  color: var(--teal-dark);
}
.sidebar-item .count { font-size: .75rem; color: var(--text-muted); }
.sidebar-item.active .count { color: var(--teal); }

.browse-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.3rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.browse-count { font-size: .88rem; color: var(--text-muted); }
.sort-select {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  color: var(--text-muted);
}
.sort-select select {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .3rem .7rem;
  font-size: .85rem;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
}
.sort-select select:focus { outline: none; border-color: var(--teal); }

/* ── Book detail ──────────────────────────────────────────── */
.book-detail-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2.5rem;
  align-items: start;
}
.book-detail-cover {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: calc(var(--navbar-h) + 1.5rem);
}
.book-detail-cover .book-cover-wrap { aspect-ratio: 2/3; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--teal); }
.breadcrumb .sep { color: var(--border-dark); }

.book-detail-cat {
  display: inline-block;
  background: var(--teal-light);
  color: var(--teal);
  font-size: .72rem;
  font-weight: 700;
  padding: .2rem .7rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .8rem;
}
.book-detail-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: .5rem;
}
.book-detail-author { font-size: 1rem; color: var(--text-muted); margin-bottom: 1.5rem; }

.book-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: .6rem;
  margin-bottom: 1.5rem;
}
.meta-item { background: var(--bg); border-radius: 8px; padding: .6rem .8rem; }
.meta-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); margin-bottom: .15rem; }
.meta-value { font-size: .88rem; font-weight: 500; color: var(--text); }

.read-action {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: var(--teal);
  color: #fff;
  padding: .8rem 2rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: .95rem;
  margin-bottom: .5rem;
  transition: background .2s;
}
.read-action:hover { background: var(--teal-dark); color: #fff; }
.read-note { font-size: .78rem; color: var(--text-muted); display: flex; align-items: center; gap: .3rem; }

.action-row { display: flex; align-items: center; gap: .8rem; margin-bottom: 2rem; flex-wrap: wrap; }
.btn-action {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1.1rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  transition: all .15s;
}
.btn-action:hover { background: var(--teal-light); border-color: var(--teal-mid); color: var(--teal-dark); }
.btn-action.active { background: var(--teal-light); border-color: var(--teal); color: var(--teal); }

.book-description { font-size: .95rem; line-height: 1.7; color: var(--text-muted); margin-bottom: 2rem; }

.toc-list { list-style: none; }
.toc-item {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
  color: var(--text-muted);
}
.toc-item:last-child { border-bottom: none; }
.toc-num { font-size: .75rem; color: var(--text-light); width: 24px; text-align: right; flex-shrink: 0; }

.tags-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.tag {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: .78rem;
  padding: .25rem .7rem;
  border-radius: 20px;
  transition: all .15s;
}
.tag:hover { background: var(--teal-light); border-color: var(--teal-mid); color: var(--teal); }

/* ── Reader ───────────────────────────────────────────────── */
body.reader-body { overflow: hidden; }
.reader-shell {
  height: calc(100vh - var(--navbar-h));
  display: flex;
  flex-direction: column;
}
.reader-bar {
  background: var(--navy-2);
  border-bottom: 1px solid var(--navy-4);
  padding: .6rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
}
.reader-book-info .title { font-weight: 600; color: #e0eeea; font-size: .92rem; }
.reader-book-info .author { font-size: .75rem; color: #5a7870; }
.reader-book-info .badge { display: inline-block; background: rgba(26,107,90,.25); color: var(--teal-mid); font-size: .68rem; font-weight: 700; padding: .1rem .5rem; border-radius: 10px; margin-right: .4rem; }
.reader-actions { display: flex; align-items: center; gap: .6rem; }
.reader-note { font-size: .75rem; color: #4a6860; }
#pdf-frame { flex: 1; border: none; width: 100%; display: block; background: #2c3040; }

/* ── Dashboard ────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}
.dash-hero {
  grid-column: 1 / -1;
  background: var(--navy);
  border-radius: var(--radius-lg);
  padding: 2rem 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}
.dash-hero-left h2 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  color: #fff;
  margin-bottom: .2rem;
}
.dash-hero-left .subtitle { color: #6b8a84; font-size: .9rem; }
.dash-stats { display: flex; gap: 2rem; }
.dash-stat { text-align: center; }
.dash-stat-num { font-family: var(--font-display); font-size: 1.8rem; color: #fff; font-weight: 700; line-height: 1; }
.dash-stat-label { font-size: .72rem; color: #5a7870; text-transform: uppercase; letter-spacing: .06em; margin-top: .2rem; }

.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.dash-card-head {
  padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dash-card-title { font-weight: 600; font-size: .9rem; }
.dash-card-body { padding: 1.2rem 1.4rem; }

.progress-book {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: color .15s;
}
.progress-book:last-child { border-bottom: none; }
.progress-book:hover { color: var(--teal); }
.progress-info { flex: 1; min-width: 0; }
.progress-title { font-weight: 500; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-cat   { font-size: .75rem; color: var(--text-muted); margin-bottom: .4rem; }
.progress-bar-wrap { background: var(--bg); border-radius: 20px; height: 5px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--teal); border-radius: 20px; transition: width .4s; }
.progress-pct { font-size: .75rem; color: var(--teal); font-weight: 600; flex-shrink: 0; }

.notif-item {
  display: flex;
  gap: .8rem;
  align-items: flex-start;
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .88rem;
}
.notif-item:last-child { border-bottom: none; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); flex-shrink: 0; margin-top: .45rem; }
.notif-text { flex: 1; }
.notif-title { font-weight: 500; margin-bottom: .1rem; }
.notif-sub   { color: var(--text-muted); font-size: .8rem; }
.notif-time  { font-size: .75rem; color: var(--text-light); flex-shrink: 0; }

/* ── Advanced search ──────────────────────────────────────── */
.search-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
}
.search-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.2rem;
  margin-bottom: 1.5rem;
}
.form-group label {
  display: block;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-bottom: .4rem;
}
.form-group input, .form-group select {
  width: 100%;
  padding: .65rem .9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-size: .9rem;
  color: var(--text);
  transition: border-color .2s;
}
.form-group input:focus, .form-group select:focus {
  outline: none; border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(26,107,90,.1);
}

/* ── Auth ─────────────────────────────────────────────────── */
.auth-wrap { max-width: 440px; margin: 3rem auto; }
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow);
}
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo .abbr {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  width: 56px; height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto .8rem;
}
.auth-card h2 { font-family: var(--font-display); font-size: 1.6rem; margin-bottom: .3rem; text-align: center; }
.auth-subtitle { text-align: center; color: var(--text-muted); font-size: .88rem; margin-bottom: 2rem; }
.form-footer { text-align: center; margin-top: 1.2rem; font-size: .88rem; color: var(--text-muted); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .6rem 1.4rem;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .2s;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}
.btn-primary   { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); color: #fff; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a93226; color: #fff; }
.btn-ghost     { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: .35rem .85rem; font-size: .82rem; border-radius: 6px; }
.btn-lg { padding: .8rem 2rem; font-size: 1rem; border-radius: 10px; }
.btn-full { width: 100%; }

/* ── Pagination ───────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .3rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}
.page-btn {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: .88rem;
  border: 1px solid var(--border);
  color: var(--text);
  transition: all .15s;
  padding: 0 .5rem;
  text-decoration: none;
}
.page-btn:hover { background: var(--teal); color: #fff; border-color: var(--teal); }
.page-btn.active { background: var(--teal); color: #fff; border-color: var(--teal); font-weight: 600; }
.page-btn.disabled { opacity: .35; pointer-events: none; }

/* ── Admin layout ─────────────────────────────────────────── */
.admin-wrap {
  display: flex;
  min-height: calc(100vh - var(--navbar-h));
}
.admin-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0;
}
.admin-sidebar-logo {
  padding: 0 1.4rem 1.5rem;
  border-bottom: 1px solid var(--navy-3);
  margin-bottom: 1rem;
  font-family: var(--font-display);
  font-size: .95rem;
  color: #9ab8b0;
  font-weight: 600;
}
.admin-nav-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #3a5a52;
  padding: .5rem 1.4rem .3rem;
}
.admin-nav-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .65rem 1.4rem;
  color: #8fb8b0;
  font-size: .88rem;
  font-weight: 400;
  transition: all .15s;
  text-decoration: none;
  border-left: 3px solid transparent;
}
.admin-nav-item:hover { background: var(--navy-2); color: #c8e6df; }
.admin-nav-item.active { background: var(--navy-2); color: #fff; border-left-color: var(--teal); }
.admin-nav-icon { width: 18px; text-align: center; font-size: .9rem; }

.admin-main { flex: 1; padding: 2rem; overflow-x: auto; background: var(--bg); }
.admin-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.8rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.admin-page-head h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
}

/* ── Stat cards ───────────────────────────────────────────── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem 1.5rem;
  box-shadow: var(--shadow-sm);
}
.stat-card-num  { font-family: var(--font-display); font-size: 2.2rem; font-weight: 700; color: var(--teal); line-height: 1; }
.stat-card-label{ font-size: .82rem; color: var(--text-muted); margin-top: .3rem; }

/* ── Tables ───────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.data-table th {
  background: var(--navy);
  color: #8fb8b0;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .85rem 1rem;
  text-align: left;
  white-space: nowrap;
}
.data-table td {
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .88rem;
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f9f7f3; }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .18rem .6rem;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-admin   { background: #fef3c7; color: #92400e; }
.badge-user    { background: var(--teal-light); color: var(--teal-dark); }
.badge-active  { background: #d1fae5; color: #065f46; }
.badge-inactive{ background: #fee2e2; color: #991b1b; }
.badge-featured{ background: #fef3c7; color: #92400e; }

/* ── Forms ────────────────────────────────────────────────── */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}
.form-section-title {
  font-weight: 600;
  font-size: .88rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 1rem;
  margin-top: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: .5rem;
}
.form-section-title:first-child { margin-top: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.form-group textarea {
  width: 100%;
  padding: .65rem .9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-size: .9rem;
  color: var(--text);
  min-height: 110px;
  resize: vertical;
  transition: border-color .2s;
}
.form-group textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(26,107,90,.1); }
.form-hint { font-size: .75rem; color: var(--text-light); margin-top: .3rem; }

/* ── Upload area ──────────────────────────────────────────── */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  transition: border-color .2s, background .2s;
  cursor: pointer;
  position: relative;
}
.upload-area:hover, .upload-area.drag-over {
  border-color: var(--teal);
  background: var(--teal-light);
}
.upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.upload-icon { font-size: 2rem; margin-bottom: .5rem; opacity: .5; }
.upload-text { font-size: .88rem; color: var(--text-muted); }
.upload-hint { font-size: .75rem; color: var(--text-light); margin-top: .3rem; }

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  background: var(--navy);
  color: #4a6a62;
  padding: 3.5rem 2rem 2rem;
  margin-top: auto;
}
.footer-grid {
  max-width: 1300px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2.5rem;
}
.footer-brand { font-family: var(--font-display); font-size: 1.1rem; color: #c8d8d4; font-weight: 700; margin-bottom: .5rem; }
.footer-org { color: #4a6a62; font-size: .82rem; line-height: 1.6; margin-bottom: 1rem; }
.footer-contact { font-size: .78rem; color: #4a6a62; }
.footer-contact a { color: #5a7870; }
.footer-col-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: #3a5a52; margin-bottom: .8rem; }
.footer-links { list-style: none; display: flex; flex-direction: column; gap: .4rem; }
.footer-links a { color: #4a6a62; font-size: .85rem; transition: color .15s; }
.footer-links a:hover { color: #c8d8d4; }
.footer-bottom {
  max-width: 1300px;
  margin: 0 auto;
  border-top: 1px solid var(--navy-3);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .8rem;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ── Misc ─────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 3.5rem; margin-bottom: 1rem; opacity: .4; }
.empty-state h3 { font-family: var(--font-display); font-size: 1.2rem; margin-bottom: .4rem; color: var(--text); }

.divider { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  .browse-layout { grid-template-columns: 200px 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .navbar { padding: 0 1rem; }
  .navbar-search { display: none; }
  .hero { padding: 3rem 1.2rem; }
  .hero-stats { gap: 1.5rem; }
  .browse-layout { grid-template-columns: 1fr; }
  .browse-sidebar { position: static; }
  .book-detail-layout { grid-template-columns: 1fr; }
  .book-detail-cover { position: static; max-width: 200px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .featured-month { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .admin-wrap { flex-direction: column; }
  .admin-sidebar { width: 100%; padding: .8rem 0; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}
