/* ============================================================
   style.css — Smart Blood Bank Global Styles
   Aesthetic: Medical-precision meets urgency — deep charcoal,
   rich crimson, clean whites. Clinical without being cold.
   Font: Sora (display) + DM Sans (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;600;700;800&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── CSS Variables ──────────────────────────────────────── */
:root {
  --red:        #c8102e;
  --red-dark:   #9b0a22;
  --red-light:  #ff4d6d;
  --red-glow:   rgba(200, 16, 46, 0.15);
  --bg:         #0f0f13;
  --bg2:        #16161d;
  --bg3:        #1e1e28;
  --card:       #1a1a24;
  --border:     rgba(255,255,255,0.07);
  --border2:    rgba(200,16,46,0.3);
  --text:       #f0f0f5;
  --text-muted: #888;
  --text-dim:   #555;
  --green:      #22c55e;
  --amber:      #f59e0b;
  --blue:       #3b82f6;
  --shadow:     0 4px 24px rgba(0,0,0,0.5);
  --shadow-red: 0 4px 20px rgba(200,16,46,0.25);
  --radius:     12px;
  --radius-sm:  8px;
  --transition: 0.2s ease;
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--red-light); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.8; }

h1, h2, h3, h4 { font-family: 'Sora', sans-serif; line-height: 1.2; }

/* ── Layout Helpers ─────────────────────────────────────── */
.container      { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.flex           { display: flex; }
.flex-col       { flex-direction: column; }
.items-center   { align-items: center; }
.justify-between{ justify-content: space-between; }
.gap-sm         { gap: 12px; }
.gap-md         { gap: 20px; }
.gap-lg         { gap: 32px; }
.mt-sm          { margin-top: 12px; }
.mt-md          { margin-top: 20px; }
.mt-lg          { margin-top: 32px; }
.text-center    { text-align: center; }
.hidden         { display: none !important; }

/* ── Navbar ─────────────────────────────────────────────── */
.navbar {
  background: rgba(15,15,19,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}

.navbar-brand .drop {
  width: 32px; height: 32px;
  background: var(--red);
  border-radius: 50% 50% 50% 10%;
  transform: rotate(-45deg);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-red);
}

.navbar-nav {
  display: flex; align-items: center; gap: 8px;
}

.nav-link {
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
}
.nav-link:hover { color: var(--text); background: var(--bg3); opacity: 1; }
.nav-link.active { color: var(--red-light); }

/* ── Sidebar Layout ─────────────────────────────────────── */
.dashboard-layout {
  display: flex;
  min-height: calc(100vh - 64px);
}

.sidebar {
  width: 240px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  flex-shrink: 0;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
}

.sidebar-section {
  padding: 0 12px;
  margin-bottom: 8px;
}

.sidebar-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 8px 12px 4px;
  font-weight: 600;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
}
.sidebar-link:hover { background: var(--bg3); color: var(--text); opacity: 1; }
.sidebar-link.active { background: var(--red-glow); color: var(--red-light); border: 1px solid var(--border2); }
.sidebar-link .icon { font-size: 1rem; width: 20px; text-align: center; }

.main-content {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

/* ── Page Header ────────────────────────────────────────── */
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 1.6rem; font-weight: 700; }
.page-header p  { color: var(--text-muted); margin-top: 4px; font-size: 0.9rem; }

/* ── Stat Cards ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color var(--transition);
}
.stat-card:hover { border-color: var(--border2); }

.stat-card .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-card .value {
  font-family: 'Sora', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  margin-top: 6px;
  color: var(--text);
}

.stat-card .value.red    { color: var(--red-light); }
.stat-card .value.green  { color: var(--green); }
.stat-card .value.amber  { color: var(--amber); }
.stat-card .value.blue   { color: var(--blue); }

.stat-card .sub {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.card-title {
  font-family: 'Sora', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

/* ── Blood Stock Grid ───────────────────────────────────── */
.blood-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
}

.blood-item {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
  transition: all var(--transition);
}
.blood-item:hover { border-color: var(--border2); transform: translateY(-2px); }

.blood-item .bg-type {
  font-family: 'Sora', sans-serif;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--red-light);
}

.blood-item .bg-units {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.blood-item .bg-units span { font-weight: 700; color: var(--text); }

.blood-item.low  { border-color: rgba(245,158,11,0.4); }
.blood-item.critical { border-color: rgba(239,68,68,0.5); background: rgba(239,68,68,0.05); }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th {
  text-align: left;
  padding: 10px 14px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Badges / Pills ─────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-pending  { background: rgba(245,158,11,0.15);  color: var(--amber); border: 1px solid rgba(245,158,11,0.3); }
.badge-approved { background: rgba(34,197,94,0.12);   color: var(--green); border: 1px solid rgba(34,197,94,0.3); }
.badge-rejected { background: rgba(239,68,68,0.12);   color: #f87171;      border: 1px solid rgba(239,68,68,0.3); }
.badge-emergency{ background: rgba(200,16,46,0.2);    color: var(--red-light); border: 1px solid var(--border2); }
.badge-urgent   { background: rgba(245,158,11,0.15);  color: var(--amber); }
.badge-normal   { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.badge-admin    { background: rgba(139,92,246,0.15);  color: #c4b5fd; }
.badge-donor    { background: rgba(200,16,46,0.15);   color: var(--red-light); }
.badge-hospital { background: rgba(59,130,246,0.15);  color: #93c5fd; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--red);
  color: #fff;
  box-shadow: var(--shadow-red);
}
.btn-primary:hover { background: var(--red-dark); transform: translateY(-1px); opacity: 1; }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--border2); background: var(--bg3); opacity: 1; }

.btn-success { background: rgba(34,197,94,0.15); color: var(--green); border: 1px solid rgba(34,197,94,0.3); }
.btn-success:hover { background: rgba(34,197,94,0.25); opacity: 1; }

.btn-danger  { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover  { background: rgba(239,68,68,0.25); opacity: 1; }

.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-control {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  transition: border-color var(--transition);
  outline: none;
  appearance: none;
}
.form-control:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-glow); }
.form-control::placeholder { color: var(--text-dim); }

select.form-control { cursor: pointer; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ── Auth Pages ──────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.auth-page::before {
  content: '';
  position: absolute;
  top: -200px; left: 50%;
  transform: translateX(-50%);
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(200,16,46,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
}

.auth-logo {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: 28px; text-align: center;
}

.auth-logo .drop-big {
  width: 52px; height: 52px;
  background: var(--red);
  border-radius: 50% 50% 50% 12%;
  transform: rotate(-45deg);
  box-shadow: var(--shadow-red);
  margin-bottom: 12px;
}

.auth-logo h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
}
.auth-logo p { color: var(--text-muted); font-size: 0.85rem; margin-top: 2px; }

/* ── Alert / Toast ───────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 16px;
  display: none;
}
.alert.show { display: block; }
.alert-error   { background: rgba(239,68,68,0.1);  color: #f87171; border: 1px solid rgba(239,68,68,0.2); }
.alert-success { background: rgba(34,197,94,0.1);  color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.alert-info    { background: rgba(59,130,246,0.1); color: #93c5fd; border: 1px solid rgba(59,130,246,0.2); }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 24px;
  display: none;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 1.2rem; line-height: 1;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text); }

/* ── Loading Spinner ─────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--red-light);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 0.9rem; }

/* ── Search Bar ──────────────────────────────────────────── */
.search-bar {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px;
}
.search-bar .form-control { max-width: 220px; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .auth-card { padding: 28px 20px; }
}

/* ── Utility animations ─────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.3s ease both; }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Landing hero ────────────────────────────────────────── */
.hero {
  min-height: calc(100vh - 64px);
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 40px 24px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 10%; left: 50%;
  transform: translateX(-50%);
  width: 800px; height: 500px;
  background: radial-gradient(ellipse, rgba(200,16,46,0.1) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content { position: relative; z-index: 1; max-width: 700px; }

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 20px;
}

.hero h1 .accent { color: var(--red-light); }

.hero p {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 32px;
  line-height: 1.7;
}

.hero-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.hero-stats {
  display: flex; gap: 40px; justify-content: center;
  margin-top: 56px; flex-wrap: wrap;
}

.hero-stat .num {
  font-family: 'Sora', sans-serif;
  font-size: 2rem; font-weight: 800; color: var(--red-light);
}
.hero-stat .lbl { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

/* ── Section headers inside dashboard ───────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  font-family: 'Sora', sans-serif;
  font-size: 0.95rem; font-weight: 700; color: var(--text);
}

/* ── User info pill in navbar ────────────────────────────── */
.user-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 99px; padding: 4px 12px 4px 4px;
  font-size: 0.82rem;
}
.user-pill .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--red); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.75rem;
}
.user-pill .uname { color: var(--text); font-weight: 500; }
.user-pill .urole { color: var(--text-muted); font-size: 0.75rem; }
