/**
 * Himilo University Student Web Portal Stylesheet
 * Full-screen responsive design for laptop, desktop, and mobile
 * Brand colors: #1798CB (Primary Blue), #046BD2 (Secondary Blue)
 */

:root {
  --primary: #1798CB;
  --secondary: #046BD2;
  --primary-light: rgba(23, 152, 203, 0.12);
  --secondary-light: rgba(4, 107, 210, 0.12);

  --bg: #f0f4f8;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
  --shadow-md: 0 6px 18px rgba(0,0,0,0.07);
  --shadow-lg: 0 12px 30px rgba(0,0,0,0.1);

  --sidebar-w: 240px;
  --header-h: 66px;
}

[data-theme="dark"] {
  --bg: #090d16;
  --surface: #111827;
  --surface-alt: #1f2937;
  --border: #263348;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 6px 18px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 30px rgba(0,0,0,0.5);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text-main);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Scrollbars */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===============================================================
   FULL-SCREEN LAYOUT (Desktop First → collapses for mobile)
   =============================================================== */

/* The old mobile-viewport div is now the full-screen app shell */
.mobile-viewport {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

/* Top App Header */
.app-header {
  height: var(--header-h);
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

/* Brand in header (desktop) */
.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.header-brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 17px;
  flex-shrink: 0;
}

.header-brand-text h1 {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  letter-spacing: -0.3px;
}

.header-brand-text span {
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
}

.header-user-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar-circle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 2px solid var(--primary);
  object-fit: cover;
  background: var(--surface-alt);
  flex-shrink: 0;
}

.user-greeting h4 {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.user-greeting p {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.header-icon-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.notif-badge-bubble {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: var(--radius-full);
}

/* ===============================================================
   BODY: Sidebar + Main Content layout (desktop)
   =============================================================== */
.portal-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - var(--header-h));
}

/* Left Sidebar Navigation */
.portal-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

.sidebar-nav-section {
  padding: 16px 12px 8px;
}

.sidebar-nav-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.7px;
  text-transform: uppercase;
  padding: 0 8px;
  margin-bottom: 6px;
  margin-top: 10px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  transition: all 0.2s ease;
  position: relative;
}

.sidebar-nav-item:hover {
  background: var(--surface-alt);
  color: var(--text-main);
}

.sidebar-nav-item.active {
  background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
  color: var(--secondary);
  font-weight: 800;
}

.sidebar-nav-item i {
  width: 20px;
  text-align: center;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  margin-bottom: 10px;
}

.sidebar-user-card img {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  border: 2px solid var(--primary);
  object-fit: cover;
}

.sidebar-user-info h4 {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.sidebar-user-info p {
  font-size: 10.5px;
  color: var(--primary);
  font-weight: 600;
}

.btn-logout-sidebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s ease;
}

.btn-logout-sidebar:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: var(--danger);
}

/* ===============================================================
   MAIN CONTENT AREA
   =============================================================== */
.screen-scroll-container {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px 40px 32px;
  background: var(--bg);
}

/* Screen Panes */
.screen-pane {
  display: none;
  max-width: 1280px;
  margin: 0 auto;
}

.screen-pane.active {
  display: block;
  animation: fadeInPane 0.25s ease;
}

@keyframes fadeInPane {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===============================================================
   PAGE HEADERS
   =============================================================== */
.page-header {
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.page-header p {
  font-size: 14px;
  color: var(--text-muted);
}

/* ===============================================================
   HERO WELCOME BANNER (Dashboard)
   =============================================================== */
.hero-banner {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  color: #fff;
  margin-bottom: 28px;
  box-shadow: 0 8px 32px rgba(4, 107, 210, 0.28);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.hero-banner::before {
  content: '';
  position: absolute;
  right: -40px;
  top: -40px;
  width: 200px;
  height: 200px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}

.hero-banner::after {
  content: '';
  position: absolute;
  right: 60px;
  bottom: -60px;
  width: 140px;
  height: 140px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}

.hero-text {
  flex: 1;
  position: relative;
  z-index: 2;
}

.hero-banner h3 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 8px;
  line-height: 1.25;
}

.hero-banner p {
  font-size: 14px;
  opacity: 0.9;
  line-height: 1.5;
  margin-bottom: 20px;
  max-width: 480px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

.hero-quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: #ffffff;
  color: var(--secondary);
  border-radius: var(--radius-full);
  font-size: 13.5px;
  font-weight: 800;
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
  transition: transform 0.2s ease;
}

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

.hero-quick-btn.secondary {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
}

/* ===============================================================
   STATS GRID (4-column desktop, 2-col tablet, 2-col mobile)
   =============================================================== */
.student-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.student-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: box-shadow 0.2s, transform 0.2s;
}

.student-stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-icon-bubble {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-num-box h4 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.stat-num-box span {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

/* ===============================================================
   SECTION HEADINGS
   =============================================================== */
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-heading h3 {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
}

.section-heading a {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

.section-heading a:hover { color: var(--secondary); }

/* ===============================================================
   HORIZONTAL SCROLL CARD LIST (Continue Reading)
   =============================================================== */
.horizontal-scroll-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.h-book-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.h-book-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.h-book-cover {
  width: 100%;
  height: 190px;
  object-fit: cover;
  background: #f1f5f9;
}

.h-book-info { padding: 12px; }

.h-book-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.h-book-author {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===============================================================
   FACULTY GRID (Desktop: 3-col grid)
   =============================================================== */
#facultiesListContainer {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.mobile-faculty-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  position: relative;
}

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

.mobile-faculty-card.authorized {
  border-left: 5px solid var(--primary);
}

.mobile-faculty-card.restricted {
  opacity: 0.65;
  border-left: 5px solid var(--text-muted);
}

.mobile-faculty-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  flex-shrink: 0;
}

.mobile-faculty-details h4 {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
  margin-bottom: 5px;
}

.mobile-faculty-details p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 10px;
}

.badge-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  display: inline-block;
}

.badge-tag-auth { background: #dcfce7; color: #15803d; }
.badge-tag-lock { background: #f1f5f9; color: #64748b; }

/* ===============================================================
   BOOK LIST (Library screen)
   =============================================================== */
.filter-chips-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-chip {
  padding: 7px 16px;
  border-radius: var(--radius-full);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-chip.active {
  background: var(--secondary);
  color: #fff;
  border-color: var(--secondary);
}

/* Library Book List Grid */
#libraryBooksList {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.list-book-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.list-book-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.list-book-cover {
  width: 80px;
  height: 115px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: #f1f5f9;
}

.list-book-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.list-book-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
  margin-bottom: 4px;
}

.list-book-author {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===============================================================
   RECOMMENDED BOOKS (Dashboard): grid of cards
   =============================================================== */
#recommendedBooksContainer {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ===============================================================
   NOTIFICATIONS LIST
   =============================================================== */
#notificationsListContainer {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

/* ===============================================================
   FULLSCREEN BOOK READER OVERLAY
   =============================================================== */
.reader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface);
  z-index: 9999;
  display: none;
  flex-direction: column;
}

.reader-overlay.active {
  display: flex;
  animation: slideFadeIn 0.3s ease;
}

@keyframes slideFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.reader-toolbar {
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.reader-book-title {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 500px;
  flex: 1;
  text-align: center;
  margin: 0 16px;
}

.reader-viewport {
  flex: 1;
  overflow-y: auto;
  background: #1e293b;
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.reader-page-card {
  background: #ffffff;
  color: #1e293b;
  width: 100%;
  max-width: 780px;
  min-height: 500px;
  border-radius: var(--radius-md);
  padding: 48px 56px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.35);
  font-size: 15px;
  line-height: 1.75;
}

.reader-bottom-bar {
  padding: 14px 24px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.reader-stepper-btn {
  padding: 9px 20px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.2s ease;
}

.reader-stepper-btn:hover { opacity: 0.9; }

/* ===============================================================
   STUDENT AUTH LOGIN SCREEN (Full-Screen Split Layout)
   =============================================================== */
.student-auth-view {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  overflow-y: auto;
  background: var(--bg);
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.student-auth-view.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.student-auth-inner {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  width: 100%;
  min-height: 100vh;
}

/* Left hero side */
.auth-hero-col {
  position: relative;
  background: linear-gradient(180deg, #051223 0%, #063879 60%, #046BD2 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 52px;
  color: #fff;
  overflow: hidden;
}

.auth-hero-col::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('../../assets/images/students_library.jpg') center/cover;
  opacity: 0.22;
}

.auth-hero-col > * { position: relative; z-index: 2; }

.auth-hero-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 0;
}

.auth-brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 24px;
  box-shadow: 0 6px 18px rgba(23,152,203,0.4);
  flex-shrink: 0;
}

.auth-hero-brand-text h1 {
  font-size: 21px;
  font-weight: 800;
  color: #fff;
}

.auth-hero-brand-text p {
  font-size: 12.5px;
  color: rgba(255,255,255,0.75);
}

.auth-hero-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 420px;
  padding: 32px 0;
}

.auth-hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(23,152,203,0.2);
  border: 1px solid rgba(23,152,203,0.4);
  padding: 5px 14px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-hero-center h2 {
  font-size: 34px;
  font-weight: 800;
  line-height: 1.25;
  color: #fff;
  margin-bottom: 14px;
  letter-spacing: -0.5px;
}

.auth-hero-center p {
  font-size: 14.5px;
  line-height: 1.65;
  color: rgba(255,255,255,0.82);
  margin-bottom: 28px;
}

.auth-feature-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  color: rgba(255,255,255,0.9);
}

.auth-feature-item i {
  color: #10b981;
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.auth-hero-footer {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  display: flex;
  justify-content: space-between;
}

/* Right form side */
.auth-form-col {
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 48px;
  position: relative;
}

.auth-form-top-bar {
  position: absolute;
  top: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-form-card {
  width: 100%;
  max-width: 420px;
}

.auth-form-header {
  margin-bottom: 26px;
}

.auth-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--secondary);
  font-size: 11.5px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
}

.auth-form-header h2 {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
  letter-spacing: -0.4px;
}

.auth-form-header p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.demo-cred-box {
  background: linear-gradient(135deg, rgba(23,152,203,0.07), rgba(4,107,210,0.07));
  border: 1px dashed var(--primary);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.demo-cred-text {
  font-size: 12.5px;
  color: var(--text-main);
  line-height: 1.4;
}

.demo-cred-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 0.2s, transform 0.2s;
}

.demo-cred-btn:hover {
  background: var(--secondary);
  transform: translateY(-1px);
}

.auth-input-group { margin-bottom: 18px; }

.auth-input-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-size: 15px;
  pointer-events: none;
}

.auth-input-field {
  width: 100%;
  padding: 13px 14px 13px 42px;
  font-size: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
  font-family: inherit;
}

.auth-input-field:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.auth-pass-toggle {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  transition: color 0.2s;
}

.auth-pass-toggle:hover { color: var(--text-main); }

.auth-submit-btn {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(4,107,210,0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin-top: 8px;
}

.auth-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(4,107,210,0.45);
}

.auth-submit-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.auth-form-footer {
  margin-top: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-muted);
}

.auth-form-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.auth-form-footer a:hover {
  text-decoration: underline;
  color: var(--secondary);
}

/* ===============================================================
   PROFILE SCREEN
   =============================================================== */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 24px;
  align-items: start;
}

.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.profile-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--primary);
  margin: 0 auto 14px;
  display: block;
}

.profile-card h3 {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.profile-info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.profile-info-card h4 {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.profile-info-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

.profile-info-row:last-child { border-bottom: none; }

.profile-info-row span { color: var(--text-muted); }

.profile-info-row strong { color: var(--text-main); text-align: right; }

/* ===============================================================
   BOTTOM NAV - Visible only on MOBILE
   =============================================================== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  align-items: center;
  justify-content: space-around;
  z-index: 200;
  padding: 0 8px;
}

.nav-tab-btn {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.nav-tab-btn i { font-size: 17px; }

.nav-tab-btn.active {
  color: var(--secondary);
  font-weight: 800;
}

/* ===============================================================
   UTILITY
   =============================================================== */
.btn-primary-mobile {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(4,107,210,0.3);
  transition: opacity 0.2s;
}

.btn-primary-mobile:hover { opacity: 0.93; }

code {
  background: var(--surface-alt);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
  font-family: 'Courier New', monospace;
  color: var(--secondary);
}

/* ===============================================================
   PROGRESS BAR
   =============================================================== */
.progress-bar-container {
  height: 5px;
  background: var(--surface-alt);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 99px;
  transition: width 0.4s ease;
}

/* ===============================================================
   RESPONSIVE BREAKPOINTS
   =============================================================== */

/* Tablet (≤1024px): stack sidebar, 2-col grids */
@media (max-width: 1024px) {
  :root { --sidebar-w: 200px; }
  .student-stats-row { grid-template-columns: repeat(2, 1fr); }
  #facultiesListContainer { grid-template-columns: repeat(2, 1fr); }
  #notificationsListContainer { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .auth-hero-center h2 { font-size: 28px; }
}

/* Large Mobile / Small Tablet (≤768px): hide sidebar, show bottom nav */
@media (max-width: 768px) {
  .portal-sidebar { display: none; }
  .bottom-nav { display: flex; }
  .screen-scroll-container { padding: 16px 16px 80px 16px; }
  .hero-banner { flex-direction: column; align-items: flex-start; padding: 24px 20px; }
  .hero-banner h3 { font-size: 20px; }
  .student-stats-row { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  #facultiesListContainer { grid-template-columns: 1fr; }
  #libraryBooksList { grid-template-columns: 1fr; }
  #recommendedBooksContainer { grid-template-columns: 1fr; }
  #notificationsListContainer { grid-template-columns: 1fr; }
  .horizontal-scroll-list {
    display: flex;
    overflow-x: auto;
    grid-template-columns: none;
    flex-wrap: nowrap;
    padding-bottom: 8px;
  }
  .h-book-card { min-width: 150px; width: 150px; flex-shrink: 0; }
  .reader-page-card { padding: 24px 20px; }
  .reader-viewport { padding: 16px; }

  /* Auth: hide hero column on small screens */
  .student-auth-inner { grid-template-columns: 1fr; }
  .auth-hero-col { display: none; }
  .auth-form-col { padding: 32px 20px; }
}

/* Small Mobile (≤480px) */
@media (max-width: 480px) {
  .app-header { padding: 0 16px; }
  .header-brand-text { display: none; }
  .user-greeting p { display: none; }
  .student-stats-row { gap: 8px; }
  .student-stat-card { padding: 12px; gap: 10px; }
  .stat-icon-bubble { width: 40px; height: 40px; font-size: 17px; }
  .stat-num-box h4 { font-size: 18px; }
}

/* ===============================================================
   IN-APP e-READER OVERLAY (Full-Featured Educational Reader)
   =============================================================== */

.reader-overlay {
  --reader-bg: var(--bg);
  --reader-surface: var(--surface);
  --reader-surface-alt: var(--surface-alt);
  --reader-text: var(--text-main);
  --reader-text-muted: var(--text-muted);
  --reader-border: var(--border);
  --reader-canvas-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  --reader-canvas-filter: none;

  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--reader-bg);
  color: var(--reader-text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.28s ease, transform 0.28s ease, background 0.25s ease, color 0.25s ease;
  pointer-events: none;
  visibility: hidden;
}

.reader-overlay.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
  visibility: visible;
}

/* ── Reader Theme: Light ── */
.reader-overlay[data-reader-theme="light"] {
  --reader-bg: #f8fafc;
  --reader-surface: #ffffff;
  --reader-surface-alt: #f1f5f9;
  --reader-text: #0f172a;
  --reader-text-muted: #64748b;
  --reader-border: #e2e8f0;
  --reader-canvas-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  --reader-canvas-filter: none;
}

/* ── Reader Theme: Sepia (Warm Paper) ── */
.reader-overlay[data-reader-theme="sepia"] {
  --reader-bg: #f5eedb;
  --reader-surface: #faf4e6;
  --reader-surface-alt: #ede3cc;
  --reader-text: #3c2f1f;
  --reader-text-muted: #786650;
  --reader-border: #e2d5bc;
  --reader-canvas-shadow: 0 8px 30px rgba(60, 47, 31, 0.16);
  --reader-canvas-filter: sepia(0.35) contrast(0.96) brightness(0.97);
}

/* ── Reader Theme: Dark (Midnight Reading) ── */
.reader-overlay[data-reader-theme="dark"] {
  --reader-bg: #0b1120;
  --reader-surface: #141f33;
  --reader-surface-alt: #1c2b44;
  --reader-text: #f1f5f9;
  --reader-text-muted: #94a3b8;
  --reader-border: #243552;
  --reader-canvas-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
  --reader-canvas-filter: invert(0.92) hue-rotate(180deg) brightness(0.95) contrast(0.92);
}

/* ── Toolbar ── */
.reader-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: 58px;
  background: var(--reader-surface);
  border-bottom: 1px solid var(--reader-border);
  flex-shrink: 0;
  z-index: 10;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: background 0.25s ease, border-color 0.25s ease;
}

.reader-toolbar-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--reader-surface-alt);
  border: 1px solid var(--reader-border);
  color: var(--reader-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13.5px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.reader-toolbar-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
  transform: scale(1.06);
}

.reader-toolbar-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.reader-toolbar-btn.bookmarked {
  color: var(--warning);
  background: rgba(245, 158, 11, 0.12);
  border-color: var(--warning);
}

.reader-title-box {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.reader-book-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--reader-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.reader-page-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--reader-text-muted);
  line-height: 1;
}

.reader-mode-pill {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(23, 152, 203, 0.14);
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.reader-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.reader-zoom-label {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--reader-text-muted);
  min-width: 38px;
  text-align: center;
}

/* ── Content Wrapper ── */
.reader-content-wrap {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: var(--reader-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s ease;
}

/* ── PDF Canvas Scroll Area ── */
.reader-canvas-scroll {
  width: 100%;
  height: 100%;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 16px;
  touch-action: pan-x pan-y;
  cursor: grab;
  user-select: none;
}

.reader-canvas-scroll:active {
  cursor: grabbing;
}

.reader-pages-container {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 20px;
  transition: gap 0.2s ease;
}

.reader-canvas-card {
  display: inline-block;
  background: #ffffff;
  border-radius: 6px;
  box-shadow: var(--reader-canvas-shadow);
  overflow: hidden;
  transition: box-shadow 0.25s ease, transform 0.15s ease;
}

.reader-canvas-card canvas {
  display: block;
  max-width: 100%;
  height: auto;
  transform-origin: top center;
  filter: var(--reader-canvas-filter);
  transition: filter 0.25s ease;
}

/* Double-page open book spine effect */
.reader-pages-container.double-layout .reader-canvas-card:first-child {
  box-shadow: -8px 8px 24px rgba(0, 0, 0, 0.18), inset -4px 0 10px rgba(0, 0, 0, 0.05);
}

.reader-pages-container.double-layout .reader-canvas-card:last-child {
  box-shadow: 8px 8px 24px rgba(0, 0, 0, 0.18), inset 4px 0 10px rgba(0, 0, 0, 0.05);
}

/* Continuous scroll mode */
.reader-canvas-scroll.scroll-layout .reader-pages-container {
  flex-direction: column;
  gap: 24px;
}

/* ── e-Book Reflow Mode ── */
.reader-ebook-scroll {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 0 20px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  scroll-behavior: smooth;
}

.reader-ebook-toolbar {
  width: 100%;
  max-width: 760px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin: 16px 0 24px;
  background: var(--reader-surface);
  border: 1px solid var(--reader-border);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.reader-font-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reader-font-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--reader-border);
  background: var(--reader-surface-alt);
  color: var(--reader-text);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.reader-font-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.reader-ebook-body {
  width: 100%;
  max-width: 760px;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  color: var(--reader-text);
  line-height: 1.85;
  font-size: 16px;
  transition: font-size 0.2s ease;
}

.reader-ebook-body.double-column {
  column-count: 2;
  column-gap: 36px;
  column-rule: 1px solid var(--reader-border);
}

.reader-ebook-header {
  border-bottom: 2px solid var(--primary);
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.reader-ebook-category {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--primary);
  letter-spacing: 0.8px;
}

.reader-ebook-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--reader-text);
  margin-top: 6px;
  line-height: 1.3;
}

.reader-ebook-meta {
  font-size: 13px;
  color: var(--reader-text-muted);
  margin-top: 6px;
}

.reader-ebook-paragraph {
  margin-bottom: 18px;
  text-align: justify;
  text-justify: inter-word;
}

.reader-ebook-callout {
  background: var(--reader-surface-alt);
  border-left: 4px solid var(--secondary);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 24px 0;
  font-size: 14px;
  color: var(--reader-text);
}

.reader-ebook-quote {
  border-left: 4px solid var(--primary);
  padding: 12px 20px;
  margin: 20px 0;
  font-style: italic;
  color: var(--reader-text-muted);
}

/* ── Text Fallback Area ── */
.reader-text-fallback {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 28px 32px;
  background: var(--reader-bg);
  color: var(--reader-text);
  font-size: 14.5px;
  line-height: 1.7;
}

@media (max-width: 640px) {
  .reader-text-fallback { padding: 20px 18px; }
  .reader-ebook-body.double-column { column-count: 1; }
}

/* ── Loading Indicator ── */
.reader-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--reader-bg);
  z-index: 5;
  gap: 14px;
  transition: background 0.25s ease;
}

.reader-loading p {
  font-size: 13.5px;
  color: var(--reader-text-muted);
  font-weight: 600;
}

.reader-loading-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--reader-border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spinReader 0.8s linear infinite;
}

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

/* ── Bottom Navigation Bar ── */
.reader-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  background: var(--reader-surface);
  border-top: 1px solid var(--reader-border);
  flex-shrink: 0;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.05);
  transition: background 0.25s ease, border-color 0.25s ease;
}

.reader-nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 3px 10px rgba(4, 107, 210, 0.25);
}

.reader-nav-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.reader-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.reader-page-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--reader-surface-alt);
  border: 1px solid var(--reader-border);
  border-radius: var(--radius-full);
  padding: 6px 14px;
}

.reader-page-input {
  width: 46px;
  background: none;
  border: none;
  outline: none;
  font-size: 14px;
  font-weight: 800;
  color: var(--reader-text);
  font-family: inherit;
  text-align: center;
  -moz-appearance: textfield;
}

.reader-page-input::-webkit-inner-spin-button,
.reader-page-input::-webkit-outer-spin-button { -webkit-appearance: none; }

.reader-page-sep {
  font-size: 12px;
  color: var(--reader-text-muted);
  font-weight: 600;
}

.reader-total-pages {
  font-size: 13px;
  font-weight: 800;
  color: var(--primary);
}

/* ── Toast Notification ── */
.reader-toast {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--reader-surface);
  border: 1px solid var(--reader-border);
  color: var(--reader-text);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap;
  z-index: 20;
  pointer-events: none;
}

.reader-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Responsive adjustments ── */
@media (max-width: 640px) {
  .reader-toolbar { padding: 0 10px; gap: 6px; height: 52px; }
  .reader-toolbar-btn { width: 32px; height: 32px; font-size: 13px; }
  .reader-book-title { font-size: 13px; }
  .reader-zoom-label { display: none; }
  .reader-nav-btn { padding: 8px 14px; font-size: 12px; }
  .reader-bottom-bar { padding: 8px 14px; }
  .reader-pages-container { gap: 10px; }
}

@media (max-width: 480px) {
  #readerLayoutBtn { display: none; }
  #btnZoomOut, #btnZoomIn { display: none; }
}


