/* ============================================================
   DUNONG ARCHIVE - Global Styles v38 (FULLY FIXED)
   ------------------------------------------------------------
   Formatting normalized v1.2.1 - no behavioral changes.
   All -webkit-/-ms- vendor prefixes are INTENTIONAL:
     • ::-webkit-scrollbar - only way to hide scrollbars in WebKit
     • -webkit-line-clamp - multi-line text truncation (standard
                                `line-clamp` has spotty support)
     • -ms-overflow-style - IE/legacy Edge scrollbar hiding
   VS Code yellow underlines on these are false positives.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,300;14..32,400;14..32,500;14..32,600;14..32,700&family=Merriweather:wght@400;700;900&display=swap');

:root {
  --primary: #2B6CB0;
  --primary-dark: #1A4E8A;
  --primary-light: #4A90D9;
  --accent: #63B3ED;
  --accent-soft: #BEE3F8;
  --bg: #F0F4F8;
  --bg-card: #FFFFFF;
  --bg-secondary: #EDF2F7;
  --bg-tertiary: #E2E8F0;
  --text: #1A202C;
  --text-secondary: #4A5568;
  --text-muted: #718096;
  --border: #CBD5E0;
  --border-light: #E2E8F0;
  --success: #276749;
  --success-bg: #C6F6D5;
  --warning: #744210;
  --warning-bg: #FEFCBF;
  --danger: #742A2A;
  --danger-bg: #FED7D7;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-display: 'Merriweather', Georgia, serif;
  --nav-h: 55px;
  --sidebar-w: 280px;
  --transition: 0.2s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a, a:hover, a:focus, a:active, a:visited {
  text-decoration: none !important;
}

/* ========== LOGIN PAGE ========== */
.login-page {
  background: linear-gradient(135deg, #1A365D 0%, #2B6CB0 50%, #2C7A7B 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 440px;
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: fadeInUp 0.4s ease;
}

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

.login-header {
  text-align: center;
  padding: 32px 24px 20px;
  background: linear-gradient(135deg, #1A365D 0%, #2B6CB0 100%);
}

.login-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.login-title {
  color: #fff;
  font-size: 1.8rem;
  margin-bottom: 4px;
}

.login-subtitle {
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
}

.login-body {
  padding: 28px 24px 20px;
}

.security-notice {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.sso-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.sso-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  transition: all var(--transition);
}

.sso-btn:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.sso-icon-img {
  width: 20px;
  height: 20px;
}

.terms-agreement {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.terms-agreement a {
  color: var(--primary);
}

.login-footer {
  text-align: center;
  padding: 16px 24px 28px;
  border-top: 1px solid var(--border-light);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.turnstile {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
}

.turnstile-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #38A169;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.75rem;
}

/* ========== FLOATING NAVBAR ========== */
.navbar {
  height: var(--nav-h);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  position: fixed;
  top: 16px;
  left: 20px;
  right: 20px;
  z-index: 100;
  backdrop-filter: blur(10px);
  background: rgba(255,255,255,0.95);
  transition: left 0.3s ease;
}

/* During page-load animation, disable the left transition so the
   navbar only slides DOWN (top-to-down), not from the upper-left. */
.navbar.no-transition {
  transition: none !important;
}

/* When sidebar is visible (not hidden) */
.sidebar:not(.hidden) ~ #topbar-container .navbar {
  left: calc(20px + var(--sidebar-w) + 20px);
}

.navbar-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

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

.sidebar-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  border-radius: var(--radius-sm);
}

.sidebar-toggle:hover {
  background: var(--bg-secondary);
}

.sidebar-toggle img {
  width: 22px;
  height: 22px;
  display: block;
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
}

.mobile-menu-btn:hover {
  background: var(--bg-secondary);
}

.mobile-menu-btn img {
  width: 22px;
  height: 22px;
  display: block;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--primary);
}

.brand-logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.brand-text {
  letter-spacing: -0.3px;
  font-size: 0.85rem;
}

/* Notification Icon */
.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.notification-icon {
  position: relative;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: all var(--transition);
}

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

.notification-icon img {
  width: 24px;
  height: 24px;
  display: block;
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.notification-badge.hidden {
  display: none;
}

/* Notification dropdown - the panel itself never scrolls. Header
   and footer stay pinned; only the list scrolls (v1.4.9 fix: the
   "Mark all as read" button used to drift out of view when the
   notification list got long). */
.notification-dropdown {
  position: absolute;
  top: calc(var(--nav-h) + 10px);
  right: 20px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 340px;
  max-height: 460px;
  overflow: hidden;
  z-index: 101;
  display: none;
  flex-direction: column;
  padding: 0;
  border: 1px solid var(--border-light);
}

.notification-dropdown.show {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.notification-dropdown #notification-dropdown-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 0;
}

.notif-dropdown-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.notif-dropdown-item:last-child {
  border-bottom: none;
}

.notif-dropdown-item:hover {
  background: var(--bg-secondary);
}

.notif-dropdown-item.unread {
  background: rgba(43,108,176,0.05);
}

.notif-dropdown-text {
  font-size: 0.8rem;
  color: var(--text);
  margin: 0;
  line-height: 1.4;
}

.notif-dropdown-time {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin: 0;
}

.notif-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.dropdown-header {
  padding: 12px 16px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.85rem;
  color: #fff;
  background: linear-gradient(180deg, #1A365D 0%, #1E3A5F 100%);
  border-radius: var(--radius) var(--radius) 0 0;
  flex-shrink: 0;
}

.dropdown-footer {
  padding: 10px 16px;
  text-align: center;
  border-top: 1px solid rgba(255,255,255,0.1);
  background: linear-gradient(180deg, #1A365D 0%, #1E3A5F 100%);
  border-radius: 0 0 var(--radius) var(--radius);
  flex-shrink: 0;
}

.dropdown-footer button {
  background: none;
  border: none;
  color: #BEE3F8;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.dropdown-footer button:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

/* ========== SIDEBAR & APP LAYOUT ========== */
/* v1.4.9 spacing rework:
   • Uniform 12px frame gutter (screen→sidebar, sidebar→content,
     content→screen) so content card edges line up with the
     top bar's edges. v1.5.3: tightened from 20px - the wider
     frame read as padded filler.
   • Compact gap between the top bar and the page content
     (14px clear gap instead of 36px). */
.app-layout {
  display: flex;
  min-height: 100vh;
  padding-top: calc(var(--nav-h) + 12px);
  padding-left: 12px;
  padding-right: 12px;
  position: relative;
}

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #1A365D 0%, #1E3A5F 100%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  position: fixed;
  left: 12px;
  top: 12px;
  height: calc(100vh - 24px);
  overflow-y: auto;
  z-index: 99;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, opacity 0.3s ease;
  scrollbar-width: none;
}

/* Hide scrollbar in WebKit browsers (no standard equivalent exists). */
.sidebar::-webkit-scrollbar {
  display: none;
}

/* Desktop hidden state */
.sidebar.hidden {
  transform: translateX(calc(-1 * (var(--sidebar-w) + 12px)));
  opacity: 0;
  pointer-events: none;
}

/* ── v1.5.3: Teacher sidebar notification badges ─────────────
   Green count pills on the Verification List, Manage Users, and
   Manage Manuscripts sidebar links when their review queue has
   pending entries; hidden entirely (no pill) when a queue is
   empty. These rules previously lived in css/Sidebar.css, a file
   no page ever loaded (the badges rendered as bare unstyled
   numbers). They now live here, on the real page stylesheet. */
.sidebar-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: auto;
  border-radius: 999px;
  background: #2F855A;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-badge.hidden {
  display: none;
}

/* Main content - margin driven by applyMainMargin() in components.js
   (.sidebar ~ .app-main selector can't work because sidebar is inside #sidebar-container)
   v1.5.3: no horizontal padding - the app-layout 12px gutters plus
   the sidebar+12px margin position the cards exactly between the
   sidebar and the screen edge, aligned with the top bar. Top/bottom
   padding tightened (24/32 -> 14/24) so pages sit closer to the bar. */
.app-main {
  flex: 1;
  margin-left: calc(var(--sidebar-w) + 12px);
  padding: 14px 0 24px;
  min-height: calc(100vh - var(--nav-h) - 44px);
  transition: margin-left 0.3s ease, width 0.3s ease;
  width: calc(100% - var(--sidebar-w) - 36px);
}

.sidebar-header {
  display: flex;
  justify-content: flex-end;
  padding: 8px 20px 0;
}

.sidebar-close {
  background: rgba(255,255,255,0.15);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 1rem;
}

.sidebar-profile {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  gap: 10px;
  align-items: center;
}

.sidebar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

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

.sidebar-avatar span {
  font-size: 1.15rem;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-weight: 700;
  color: #fff;
  font-size: 0.88rem;
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-lrn {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.5);
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.6);
}

.sidebar-links {
  padding: 10px 0;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  margin: 2px 12px;
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(255,255,255,0.75);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  cursor: pointer;
}

.sidebar-link:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.sidebar-link.active {
  background: #fff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

.sidebar-link .cnt {
  background: var(--accent-soft);
  color: var(--primary-dark);
  border-radius: 999px;
  font-size: 0.7rem;
  padding: 2px 8px;
  font-weight: 700;
}

/* Sidebar Separator - ONLY FOR TEACHER (KEPT) */
.sidebar-separator {
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
  margin: 12px 20px;
}

.sidebar-logout {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: auto;
  flex-shrink: 0;
}

.sidebar-logout-btn {
  width: 100%;
  padding: 10px 16px;
  background: #fff;
  color: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
}

.sidebar-logout-btn:hover {
  background: var(--bg-secondary);
}

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 98;
}

/* ========== PAGE CONTAINER ========== */
.page-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 28px;
}

/* ========== COMMON COMPONENTS ========== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

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

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success);
}

.btn-success:hover {
  background: var(--success);
  color: #fff;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 12px 28px;
  font-size: 1rem;
}

/* ── Badges ──
   badge-green is solid green background + white text so it's
   consistent everywhere: sidebar verified badge, users table
   status column (Verified / Unverified / Active). */
.badge {
  display: inline-flex;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-green {
  background: #38A169;
  color: #fff;
}

.badge-yellow {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-blue {
  background: var(--accent-soft);
  color: var(--primary-dark);
}

.badge-red {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-unverified {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.form-label .req {
  color: #E53E3E;
  margin-left: 2px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: var(--bg-card);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
}

.form-input:disabled {
  background: var(--bg-secondary);
  color: var(--text-muted);
}

.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: var(--bg-card);
  cursor: pointer;
}

.form-select:focus {
  outline: none;
  border-color: var(--primary);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.panel-header h2 {
  font-size: 1.3rem;
  margin-bottom: 2px;
}

.panel-header p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Empty state - centered both axes */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
  width: 100%;
  min-height: 280px;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ── Toast Notifications ── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 360px;
  padding: 13px 14px 13px 16px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
  pointer-events: auto;
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 0.28s ease, transform 0.28s ease;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
}

.toast-show {
  opacity: 1 !important;
  transform: translateX(0) !important;
}

.toast-hide {
  opacity: 0 !important;
  transform: translateX(24px) !important;
}

.toast-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.toast-msg {
  flex: 1;
  color: #1A202C;
}

.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 2px;
  color: #718096;
  flex-shrink: 0;
}

.toast-close:hover {
  color: #1A202C;
}

.toast-info {
  background: #EBF8FF;
  border-left: 4px solid #3182CE;
}

.toast-success {
  background: #F0FFF4;
  border-left: 4px solid #38A169;
}

.toast-warning {
  background: #FFFBEB;
  border-left: 4px solid #D69E2E;
}

.toast-danger {
  background: #FFF5F5;
  border-left: 4px solid #E53E3E;
}

@media (max-width: 768px) {
  #toast-container {
    bottom: 16px;
    right: 12px;
    left: 12px;
  }

  .toast {
    min-width: unset;
    max-width: 100%;
  }
}

/* ========== SKELETON LOADING ==========
   Replaces spinners throughout the app with shimmer-animated
   placeholder blocks shaped like the content that's loading.
   Looks better + feels faster than a bare spinner. */

/* Shimmer base - a moving gradient sweep. Apply to any block. */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 0%,
    var(--bg-secondary) 50%,
    var(--bg-tertiary) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Skeleton wrapper - fills the loading container's space so
   the layout doesn't jump when real content arrives. */
.skeleton-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 0;
}

/* ── Manuscript card skeleton ──
   Shaped to match renderManuscriptCard(): title, meta row,
   3 abstract lines, footer with a button placeholder. */
.skeleton-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 180px;
}

.skeleton-line {
  height: 12px;
  border-radius: 6px;
}

.skeleton-line.title {
  height: 16px;
  width: 80%;
  margin-bottom: 4px;
}

.skeleton-line.short {
  width: 50%;
}

.skeleton-line.medium {
  width: 70%;
}

.skeleton-line.long {
  width: 100%;
}

/* Manuscript grid skeleton - same grid layout as .manuscripts-grid */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* ── Notification list skeleton ──
   Shaped to match .notif-item: dot + two lines. */
.skeleton-notif {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  align-items: flex-start;
}

.skeleton-notif-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}

.skeleton-notif-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Photo grid skeleton (verification modal) ── */
.skeleton-photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 12px;
}

.skeleton-photo {
  width: 100%;
  height: 200px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-secondary);
  background-image: linear-gradient(
    90deg,
    var(--bg-tertiary) 0%,
    var(--bg-secondary) 50%,
    var(--bg-tertiary) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

@media (max-width: 768px) {
  .skeleton-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .skeleton-photo-grid {
    grid-template-columns: 1fr;
  }
}

/* ========== AUTO-BAN MODAL ==========
   Shown when the frontend file validators detect a disguised
   file (image or PDF with wrong magic bytes). The backend has
   already banned the user's IP + account for lifetime by the
   time this modal appears. */
.autoban-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.autoban-modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  max-width: 460px;
  width: 100%;
  padding: 36px 28px 28px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

.autoban-modal-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #FED7D7;
  color: #C53030;
  font-size: 2.4rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.autoban-modal-title {
  color: var(--text);
  font-size: 1.3rem;
  margin-bottom: 14px;
  font-family: var(--font-display);
}

.autoban-modal-message {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.6;
  margin-bottom: 20px;
}

.autoban-modal-consequence {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 24px;
}

.autoban-modal-banned-label {
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 600;
  margin: 0;
}

.autoban-modal-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 28px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
  font-family: var(--font-body);
}

.autoban-modal-btn:hover {
  background: var(--primary-dark);
}

/* ── Dangerous File warning modal ──
   First-offense warning modal. Same card layout as the auto-ban
   modal, but with a green "Okay" button instead of blue. */
.dangerous-file-ok-btn {
  background: #28A745;
  color: #fff;
  border: none;
  padding: 10px 28px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
  font-family: var(--font-body);
}

.dangerous-file-ok-btn:hover {
  background: #218838;
}

/* ========== MANUSCRIPT CARD ========== */
.manuscript-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 18px;
  transition: all var(--transition);
  cursor: pointer;
}

.manuscript-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.manuscript-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary);
  margin-bottom: 8px;
}

.manuscript-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  align-items: center;
}

/* ── Multi-line abstract clamp ──
   -webkit-line-clamp is the only widely-supported way to truncate
   text to N lines with an ellipsis. VS Code's yellow underline is
   a known false positive - do NOT remove. */
.manuscript-abstract {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.manuscript-footer {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
}

.course-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.65rem;
  font-weight: 500;
  color: #fff;
}

.favorite-icon {
  width: 18px;
  height: 18px;
}

.star-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

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

/* Back to Top Button */
.back-to-top-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  z-index: 90;
}

.back-to-top-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
}

/* ========== SEARCH RESULT ITEMS (shared) ==========
   Moved from css/Home.css so the same expandable card style
   is available on the home page, favorites page, and teacher
   manage-manuscripts page. All three now use the same item
   styling for consistency. */

.search-result-item {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  box-sizing: border-box;
}

.search-result-item:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.search-result-item.expanded {
  box-shadow: var(--shadow-lg);
}

.search-result-preview {
  padding: 0;
}

.search-result-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.4;
}

.search-result-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  font-size: 0.85rem;
}

.result-authors {
  color: var(--text-secondary);
}

.result-year {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.search-result-abstract {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.4;
  margin-bottom: 0;
}

.search-result-expanded {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.search-result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.view-doc-btn {
  flex: 0 1 auto;
  padding: 8px 16px;
  background: #228B22;
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.view-doc-btn:hover {
  background: #2CA02C;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.favorite-action-btn {
  flex: 0 1 auto;
  padding: 8px 16px;
  background: none;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.favorite-action-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--bg-secondary);
}

.favorite-icon-action {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.fav-text {
  display: inline;
}

/* Delete-action button (teacher manuscripts) - same shape as the
   favorite-action-btn so the card looks consistent, but with a
   danger-red hover. */
.delete-action-btn {
  flex: 0 1 auto;
  padding: 8px 16px;
  background: none;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.delete-action-btn:hover {
  background: #DC3545;
  color: #fff;
  border-color: #DC3545;
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .search-result-item {
    width: 100%;
    margin: 0 0 12px 0;
  }

  .search-result-meta {
    gap: 8px;
  }

  .search-result-actions {
    flex-direction: column;
  }

  .view-doc-btn,
  .favorite-action-btn,
  .delete-action-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ========== MODAL SCROLLBAR - INVISIBLE ========== */
/* Hides the scrollbar in all modal containers (both teacher and
   global pages) while keeping the modal scrollable. The user can
   still scroll with the mouse wheel / trackpad / touch - they
   just won't see a visible scrollbar track.
   -ms-overflow-style covers IE/legacy Edge; scrollbar-width
   covers Firefox; ::-webkit-scrollbar covers Chrome/Safari/Edge. */
.modal-content,
.turnstile-modal-content {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.modal-content::-webkit-scrollbar,
.turnstile-modal-content::-webkit-scrollbar {
  display: none;
}

/* ========== MOBILE ========== */
@media (max-width: 768px) {
  .sidebar-toggle {
    display: none !important;
  }

  .mobile-menu-btn {
    display: flex !important;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 50%;
    height: 100%;
    border-radius: 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 300;
  }

  .sidebar.open {
    transform: translateX(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    height: 100vh;
    overflow-y: auto;
  }

  .sidebar.mobile-closed {
    transform: translateX(-100%) !important;
    pointer-events: none !important;
  }

  .sidebar.hidden {
    transform: translateX(-100%);
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-close {
    display: flex;
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    z-index: 10;
  }

  /* Mobile overlay - darken the page (excluding the sidebar) when
     the sidebar is open. Click on it closes the sidebar. */
  .mobile-overlay {
    display: none !important;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    backdrop-filter: blur(2px);
  }

  .mobile-overlay.open {
    display: block !important;
  }

  .app-main {
    margin-left: 0 !important;
    padding: 12px;
    width: 100% !important;
  }

  .app-layout {
    padding-left: 8px;
    padding-right: 8px;
  }

  .sidebar-profile {
    padding: 70px 20px 20px;
  }

  .sidebar-links {
    padding: 16px 0;
  }

  .sidebar-link {
    padding: 12px 20px;
    margin: 2px 12px;
    font-size: 0.95rem;
  }

  .sidebar-logout {
    padding: 20px;
  }

  .navbar {
    left: 8px;
    right: 8px;
    top: 8px;
  }

  .navbar-inner {
    padding: 0 16px;
  }

  .brand-logo {
    width: 20px;
    height: 20px;
  }

  .brand-text {
    font-size: 0.75rem;
  }

  .notification-dropdown {
    right: 12px;
    width: 300px;
    max-width: calc(100vw - 24px);
  }

  .page-container {
    padding: 20px;
  }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel-header h2 {
    font-size: 1.2rem;
  }

  .card {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .app-main {
    padding: 12px;
  }

  .page-container {
    padding: 16px;
  }

  .card {
    padding: 16px;
  }

  .notification-dropdown {
    width: calc(100vw - 24px);
    right: 12px;
    left: 12px;
  }
}

/* ========== PAGE TRANSITIONS ========== */
#topbar-container .navbar {
  animation: topbarPushDown 0.3s cubic-bezier(0.4,0,0.2,1);
}

@keyframes topbarPushDown {
  from { transform: translateY(-100%); opacity: 0 }
  to   { transform: translateY(0);     opacity: 1 }
}

.page-container {
  animation: pageSlideIn 0.3s cubic-bezier(0.4,0,0.2,1);
}

@keyframes pageSlideIn {
  from { transform: translateX(32px); opacity: 0 }
  to   { transform: translateX(0);    opacity: 1 }
}

.page-exit .page-container {
  animation: pageSlideOut 0.22s cubic-bezier(0.4,0,0.2,1) forwards !important;
}

@keyframes pageSlideOut {
  from { transform: translateX(0);     opacity: 1 }
  to   { transform: translateX(-32px); opacity: 0 }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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