/* ── Variables ───────────────────────────────────── */
:root {
  --accent:       #5558a8;
  --accent-h:     #4345a0;
  --accent-light: rgba(85,88,168,0.07);
  --accent-mid:   rgba(85,88,168,0.15);
  --bg:           #f0eff9;
  --white:        #ffffff;
  --text:         #25253a;
  --text-sub:     #6b6b85;
  --text-muted:   #9898b0;
  --border:       #e2e1f0;
  --shadow-sm:    0 1px 4px rgba(80,80,160,0.07);
  --shadow:       0 2px 16px rgba(80,80,160,0.10);
  --shadow-lg:    0 8px 32px rgba(80,80,160,0.14);
  --radius:       14px;
  --radius-sm:    10px;
}

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

body {
  font-family: 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Background (hidden in light mode) ──────────── */
.bg-orbs { display: none; }

/* ── Header ─────────────────────────────────────── */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 0.9rem 1.5rem;
  position: relative;
  z-index: 10;
}
.header-inner { max-width: 960px; margin: 0 auto; }
.logo { display: flex; align-items: center; gap: 0.75rem; }
.logo-emblem {
  height: 44px;
  width: 44px;
  object-fit: contain;
  flex-shrink: 0;
}
.logo-text  { display: flex; flex-direction: column; }
.logo-main  { font-size: 1.1rem; font-weight: 800; color: var(--accent); letter-spacing: -0.5px; }
.logo-sub   { font-size: 0.68rem; font-weight: 500; color: var(--text-muted); letter-spacing: 2px; text-transform: uppercase; }

/* ── Nav ────────────────────────────────────────── */
.site-nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: 0;
  z-index: 9;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  flex: 1;
  min-width: 72px;
  color: var(--text-sub);
  text-decoration: none;
  text-align: center;
  padding: 0.65rem 0.4rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  transition: all 0.18s ease;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.18rem;
}
.nav-icon { font-size: 1.05rem; }
.site-nav a:hover  { color: var(--accent); background: var(--accent-light); }
.site-nav a.active { color: var(--accent); border-bottom-color: var(--accent); background: var(--accent-light); font-weight: 700; }

/* ── Container ──────────────────────────────────── */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

/* ── Fade-up Animation ──────────────────────────── */
.fade-up { opacity: 0; transform: translateY(20px); animation: fadeUp 0.45s ease forwards; }
.delay-1 { animation-delay: 0.08s; }
.delay-2 { animation-delay: 0.16s; }
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }

/* ── Hero Banner ────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #5c60b0 0%, #7a6ec0 55%, #b0a0d4 100%);
  margin: 0 -1rem 1.5rem;
  padding: 3.5rem 2rem 3rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  top: -80px; right: -60px;
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  bottom: -60px; left: -40px;
  pointer-events: none;
}
.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  padding: 0.28rem 0.85rem;
  border-radius: 20px;
  margin-bottom: 0.9rem;
}
.hero-title {
  font-size: 1.9rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.25;
  letter-spacing: -0.5px;
  margin-bottom: 0.65rem;
  text-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.hero-accent {
  color: #e8e0ff;
}
.hero-desc {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.8);
  line-height: 1.6;
}

/* ── Card ───────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.card:hover { border-color: rgba(85,88,168,0.25); box-shadow: var(--shadow-lg); }
.card-header { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.card-icon   { font-size: 1.2rem; }
.card-title  { font-size: 0.95rem; font-weight: 700; color: var(--text); }

/* ── User / Staff Card ──────────────────────────── */
.user-card  {
  background: linear-gradient(135deg, #eeeeff, #f5f3ff);
  border-color: rgba(85,88,168,0.2);
}
.staff-card {
  background: linear-gradient(135deg, #fff8ec, #fffbf0);
  border-color: rgba(217,119,6,0.2);
}
.user-text { font-size: 0.9rem; color: var(--text-sub); margin-bottom: 1rem; line-height: 1.6; }
.user-text strong { color: var(--text); font-weight: 700; }

/* ── Login Tabs ──────────────────────────────────── */
.login-tabs {
  display: flex;
  margin: -1.3rem -1.3rem 1.25rem;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
}
.login-tab {
  flex: 1;
  background: var(--bg);
  border: none;
  color: var(--text-sub);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  padding: 0.85rem 0.5rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.18s;
}
.login-tab:hover { background: var(--white); color: var(--accent); }
.login-tab.active { background: var(--white); color: var(--accent); border-bottom-color: var(--accent); }
#tab-staff.active { color: #d97706; border-bottom-color: #d97706; }

/* ── Buttons ────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 3px 12px rgba(85,88,168,0.28);
}
.btn-primary:hover { background: var(--accent-h); transform: translateY(-1px); box-shadow: 0 5px 16px rgba(85,88,168,0.38); }
.btn-glass {
  background: var(--white);
  color: var(--accent);
  border: 1.5px solid var(--border);
}
.btn-glass:hover { background: var(--accent-light); border-color: var(--accent); }
.btn-ghost {
  background: transparent;
  color: var(--text-sub);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}
.btn-outline:hover { background: var(--accent-light); }
.btn-success {
  background: #10b981;
  color: #fff;
  box-shadow: 0 3px 10px rgba(16,185,129,0.25);
}
.btn-success:hover { background: #059669; transform: translateY(-1px); }
.btn-danger {
  background: #ef4444;
  color: #fff;
  box-shadow: 0 3px 10px rgba(239,68,68,0.25);
}
.btn-danger:hover { background: #dc2626; transform: translateY(-1px); }
.btn-staff {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: #fff;
  box-shadow: 0 3px 10px rgba(217,119,6,0.25);
}
.btn-staff:hover { transform: translateY(-1px); box-shadow: 0 5px 16px rgba(217,119,6,0.35); }
.btn-disabled {
  background: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
  pointer-events: none;
}
.btn-full { width: 100%; padding: 0.8rem; font-size: 0.95rem; }

/* ── Form ───────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
  color: var(--text-sub);
}
.input-wrap { position: relative; }
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.93rem;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: all 0.18s;
}
.form-group input::placeholder { color: var(--text-muted); }
.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-mid);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group select option { background: #fff; color: var(--text); }

/* ── Alert ──────────────────────────────────────── */
.alert {
  padding: 0.72rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.875rem;
  font-weight: 500;
}
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe; }
.hidden { display: none !important; }

/* ── Loan Item ──────────────────────────────────── */
.loan-item {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}
.loan-item:last-child { border-bottom: none; }
.loan-info .book-title { font-weight: 700; font-size: 0.95rem; color: var(--text); }
.loan-info .book-meta  { font-size: 0.8rem; color: var(--text-sub); margin-top: 0.2rem; }
.due-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.22rem 0.55rem;
  border-radius: 20px;
  white-space: nowrap;
}
.due-soon   { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.due-normal { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.due-ok     { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* ── Barcode Page ───────────────────────────────── */
.barcode-wrapper { text-align: center; padding: 1.5rem 1rem 2rem; }
.student-name    { font-size: 1.55rem; font-weight: 800; color: var(--text); }
.student-detail  { font-size: 0.87rem; color: var(--text-sub); margin: 0.3rem 0 1.5rem; }
#barcode-svg     { max-width: 100%; border-radius: 8px; }

/* ── Request List ───────────────────────────────── */
.request-item { padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.request-item:last-child { border-bottom: none; }
.request-status {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  margin-left: 0.5rem;
}
.status-pending  { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.status-approved { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.status-rejected { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Spinner ────────────────────────────────────── */
.spinner { text-align: center; padding: 2rem; color: var(--text-muted); font-size: 0.9rem; }

/* ── Staff Login ─────────────────────────────────── */
.staff-toggle-wrap { text-align: center; margin-top: 0.25rem; }
.staff-toggle-btn {
  background: none; border: none;
  color: var(--text-muted); font-size: 0.8rem; font-family: inherit;
  cursor: pointer; padding: 0.4rem 0.8rem; border-radius: 8px; transition: all 0.18s;
}
.staff-toggle-btn:hover { color: var(--text-sub); background: var(--border); }

/* ── Admin / Allloans Pages ──────────────────────── */
.admin-header {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 1.5rem 0 1rem;
}
.admin-title { font-size: 1.35rem; font-weight: 800; color: var(--text); }
.staff-badge {
  font-size: 0.78rem; color: var(--accent);
  background: var(--accent-light);
  border: 1px solid rgba(85,88,168,0.2);
  padding: 0.22rem 0.7rem; border-radius: 20px; font-weight: 600;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 0.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s;
  box-shadow: var(--shadow-sm);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-num   { font-size: 1.5rem; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: 0.68rem; color: var(--text-muted); margin-top: 0.3rem; font-weight: 600; }
.stat-pending  .stat-num { color: #d97706; }
.stat-approved .stat-num { color: #16a34a; }
.stat-rejected .stat-num { color: #dc2626; }

.filter-tabs { display: flex; gap: 0.3rem; margin-left: auto; }
.filter-btn {
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text-sub); font-size: 0.72rem; font-weight: 600;
  font-family: inherit; padding: 0.28rem 0.6rem;
  border-radius: 8px; cursor: pointer; transition: all 0.15s;
}
.filter-btn:hover  { color: var(--accent); background: var(--accent-light); border-color: var(--accent); }
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.admin-request-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.admin-request-item:last-child { border-bottom: none; }
.req-top {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 0.5rem; margin-bottom: 0.35rem;
}
.req-title  { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.req-meta   { font-size: 0.8rem; color: var(--text-sub); margin-top: 0.1rem; }
.req-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 0.3rem; }
.req-student { font-size: 0.8rem; color: var(--text-sub); }
.req-date    { font-size: 0.75rem; color: var(--text-muted); }
.req-reason  {
  font-size: 0.8rem; color: var(--text-sub);
  background: var(--bg);
  border-left: 2px solid var(--border);
  padding: 0.38rem 0.6rem;
  border-radius: 0 6px 6px 0;
  margin-top: 0.4rem;
}
.action-btns { display: flex; gap: 0.4rem; margin-top: 0.5rem; }

.search-wrap {
  margin-bottom: 0.85rem;
  position: relative;
}
.search-wrap input {
  width: 100%;
  padding: 0.65rem 0.9rem 0.65rem 2.2rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: all 0.18s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%239898b0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.65rem center;
}
.search-wrap input::placeholder { color: var(--text-muted); }
.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-mid);
  background-color: var(--white);
}

.btn-icon-delete {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  padding: 0.1rem 0.2rem;
  border-radius: 4px;
  opacity: 0.4;
  transition: opacity 0.15s;
  line-height: 1;
}
.btn-icon-delete:hover { opacity: 1; }

.reject-form {
  margin-top: 0.6rem;
  padding: 0.75rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
}
.reject-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid #fca5a5;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  margin-bottom: 0.5rem;
}
.reject-input:focus { border-color: #ef4444; }
.reject-form-btns { display: flex; gap: 0.4rem; }
.reject-reason-display {
  font-size: 0.82rem;
  color: #dc2626;
  margin-top: 0.35rem;
  padding: 0.3rem 0.6rem;
  background: #fef2f2;
  border-radius: 6px;
  border-left: 2px solid #ef4444;
}

/* ── Desktop ────────────────────────────────────── */
@media (min-width: 768px) {
  .site-header { padding: 1rem 2rem; }

  .hero {
    padding: 5rem 3rem 4.5rem;
    margin: 0 -1.5rem 2rem;
  }
  .hero-title { font-size: 2.6rem; }
  .hero-badge { font-size: 0.78rem; margin-bottom: 1.1rem; }

  .card { padding: 1.8rem; border-radius: 16px; }
  .login-tabs { margin: -1.8rem -1.8rem 1.5rem; }
  .login-tab  { padding: 1rem 0.5rem; }

  .admin-stats { gap: 0.8rem; }
  .stat-card   { padding: 1.1rem 0.75rem; }
  .stat-num    { font-size: 1.8rem; }

  .admin-header { padding: 2rem 0 1.2rem; }
  .admin-title  { font-size: 1.6rem; }
}

/* ── Scrollbar ──────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
