/* ============================================================
   Campus Blood Connect — Component Styles
   ============================================================ */

/* ── Donor Card ───────────────────────────────────────────── */
.donor-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .875rem;
  transition: box-shadow var(--transition), transform var(--transition);
}
.donor-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.donor-card-header {
  display: flex;
  align-items: center;
  gap: .875rem;
}
.donor-avatar {
  width: 48px; height: 48px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-light), #fecaca);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 1.125rem;
  flex-shrink: 0;
}
.donor-name  { font-weight: 700; color: var(--text); line-height: 1.3; }
.donor-dept  { font-size: .8125rem; color: var(--text-light); }
.donor-meta  {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
}
.donor-score-bar {
  flex: 1;
  min-width: 60px;
}
.donor-score-label {
  display: flex;
  justify-content: space-between;
  font-size: .75rem;
  color: var(--text-light);
  margin-bottom: .25rem;
}

/* ── Request Card ─────────────────────────────────────────── */
.request-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
  position: relative;
}
.request-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.request-card.critical {
  border-left: 4px solid var(--primary);
}
.request-card.urgent {
  border-left: 4px solid var(--warning);
}
.request-card.normal {
  border-left: 4px solid var(--success);
}
.request-card-header {
  padding: 1rem 1.25rem .75rem;
  display: flex;
  align-items: flex-start;
  gap: .875rem;
}
.request-card-info { flex: 1; min-width: 0; }
.request-hospital {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.request-meta {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: .375rem;
}
.request-time {
  font-size: .75rem;
  color: var(--text-lighter);
  display: flex;
  align-items: center;
  gap: .25rem;
}
.request-card-body {
  padding: 0 1.25rem .75rem;
  font-size: .875rem;
  color: var(--text-light);
}
.request-card-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
}
.request-card-actions { display: flex; gap: .5rem; }
.request-accepted-count {
  font-size: .8125rem;
  color: var(--success);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .25rem;
}

/* Unverified overlay */
.request-card .unverified-badge {
  position: absolute;
  top: .75rem; right: .75rem;
  background: var(--warning-light);
  color: #92400e;
  padding: .25rem .5rem;
  border-radius: var(--radius-sm);
  font-size: .6875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .2rem;
}

/* ── Leaderboard Item ─────────────────────────────────────── */
.lb-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .875rem 1rem;
  border-radius: var(--radius-lg);
  transition: background var(--transition);
}
.lb-item:hover { background: var(--bg); }
.lb-rank {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: .875rem;
  flex-shrink: 0;
}
.lb-rank.gold   { background: #fef3c7; color: #92400e; }
.lb-rank.silver { background: #f3f4f6; color: #6b7280; }
.lb-rank.bronze { background: #fde8d8; color: #9a3412; }
.lb-rank.other  { background: var(--bg-alt); color: var(--text-lighter); }
.lb-avatar {
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}
.lb-info { flex: 1; min-width: 0; }
.lb-name  { font-weight: 700; font-size: .9375rem; line-height: 1.3; }
.lb-dept  { font-size: .8125rem; color: var(--text-light); }
.lb-score {
  text-align: right;
  flex-shrink: 0;
}
.lb-score-num  { font-size: 1.25rem; font-weight: 800; color: var(--primary); line-height: 1; }
.lb-score-label{ font-size: .6875rem; color: var(--text-lighter); }

/* Trophy icons for top 3 */
.trophy-1::before { content: '🥇'; }
.trophy-2::before { content: '🥈'; }
.trophy-3::before { content: '🥉'; }

/* ── Profile Stats Card ───────────────────────────────────── */
.profile-stats-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  position: relative;
  overflow: hidden;
}
.profile-stats-card::before {
  content: '🩸';
  position: absolute;
  right: 1.5rem; top: 1rem;
  font-size: 5rem;
  opacity: .1;
}
.profile-stats-card .stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.25rem;
}
.profile-stat-item { text-align: center; }
.profile-stat-num  { font-size: 1.75rem; font-weight: 800; line-height: 1; }
.profile-stat-label{ font-size: .75rem; opacity: .8; margin-top: .2rem; }

/* Availability card */
.availability-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.availability-status-label {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}
.availability-status-sub {
  font-size: .8125rem;
  color: var(--text-light);
  margin-top: .125rem;
}

/* Cooldown timer */
.cooldown-card {
  background: var(--warning-light);
  border: 1px solid #fcd34d;
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: .875rem;
}
.cooldown-icon { font-size: 1.75rem; flex-shrink: 0; }
.cooldown-title { font-weight: 700; color: #92400e; margin-bottom: .25rem; }
.cooldown-text  { font-size: .875rem; color: #b45309; }
.cooldown-progress { margin-top: .75rem; }

/* ── Notification Item ────────────────────────────────────── */
.notif-item {
  display: flex;
  gap: .875rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  cursor: pointer;
  position: relative;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: var(--primary-50); }
.notif-item.unread::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 60%;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}
.notif-icon-wrap {
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.notif-icon-wrap.emergency { background: var(--primary-light); }
.notif-icon-wrap.system    { background: var(--secondary-light); }
.notif-icon-wrap.info      { background: var(--success-light); }
.notif-info { flex: 1; min-width: 0; }
.notif-title {
  font-weight: 700;
  font-size: .9rem;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: .25rem;
}
.notif-msg   { font-size: .8125rem; color: var(--text-light); line-height: 1.4; }
.notif-time  { font-size: .75rem; color: var(--text-lighter); margin-top: .375rem; }

/* ── Blood Group Selector ─────────────────────────────────── */
.bg-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
}
.bg-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  padding: .875rem .5rem;
  border: 2px solid var(--border-dark);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  background: white;
  font-weight: 800;
  font-size: 1rem;
  color: var(--text);
}
.bg-option:hover { border-color: var(--primary); background: var(--primary-50); }
.bg-option.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(220,38,38,.3);
}
.bg-option input[type="radio"] { display: none; }
.bg-drop-icon { font-size: .875rem; opacity: .7; }

/* ── Urgency Selector ─────────────────────────────────────── */
.urgency-selector { display: flex; gap: .75rem; }
.urgency-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .375rem;
  padding: .875rem .5rem;
  border: 2px solid var(--border-dark);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}
.urgency-option .urgency-label { font-weight: 700; font-size: .875rem; }
.urgency-option .urgency-sub   { font-size: .75rem; color: var(--text-lighter); }
.urgency-option.normal.selected  { border-color: var(--success); background: var(--success-light); }
.urgency-option.urgent.selected  { border-color: var(--warning); background: var(--warning-light); }
.urgency-option.critical.selected {
  border-color: var(--primary); background: var(--primary-light);
  animation: pulse-border 2s infinite;
}
.urgency-option input[type="radio"] { display: none; }
.urgency-option .urgency-icon { font-size: 1.5rem; }

/* ── Admin Table ─────────────────────────────────────────── */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.admin-table th {
  text-align: left;
  padding: .75rem 1rem;
  background: var(--bg);
  font-weight: 700;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  font-size: .8125rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.admin-table td {
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--bg); }
.table-responsive { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }

/* ── How It Works Section ─────────────────────────────────── */
.how-it-works {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 2rem;
}
.step-card {
  text-align: center;
  padding: 2rem 1.5rem;
  background: white;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  transition: box-shadow var(--transition), transform var(--transition);
}
.step-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.step-card-icon {
  width: 64px; height: 64px;
  border-radius: var(--radius-xl);
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem;
  margin: 0 auto 1.25rem;
}
.step-card-num {
  position: relative;
}
.step-card-num::after {
  content: attr(data-step);
  position: absolute;
  top: -6px; right: -6px;
  width: 20px; height: 20px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  font-size: .625rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.step-card h3 { margin-bottom: .5rem; font-size: 1.0625rem; }
.step-card p  { font-size: .875rem; }

/* ── Units Slider ─────────────────────────────────────────── */
.units-display {
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: .375rem;
}
.units-label { text-align: center; font-size: .8125rem; color: var(--text-light); }

/* ── Password Strength ────────────────────────────────────── */
.password-strength {
  margin-top: .5rem;
  display: flex;
  gap: .25rem;
  align-items: center;
}
.strength-bar {
  flex: 1;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--border);
  transition: background var(--transition);
}
.strength-bar.active.weak   { background: var(--primary); }
.strength-bar.active.fair   { background: var(--warning); }
.strength-bar.active.strong { background: var(--success); }
.strength-text {
  font-size: .75rem;
  font-weight: 600;
  min-width: 48px;
  text-align: right;
}
.strength-text.weak   { color: var(--primary); }
.strength-text.fair   { color: var(--warning); }
.strength-text.strong { color: var(--success); }

/* ── Search Box ───────────────────────────────────────────── */
.search-box {
  position: relative;
}
.search-box .search-icon {
  position: absolute;
  left: .875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-lighter);
  pointer-events: none;
}
.search-box input {
  padding-left: 2.5rem;
}

/* ── Floating Action Button ───────────────────────────────── */
.fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 90;
  width: 56px; height: 56px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 16px rgba(220,38,38,.5);
  border: none;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  animation: pulse-red 2.5s infinite;
  text-decoration: none;
}
.fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(220,38,38,.6);
  animation: none;
  color: white;
}

/* ── Dashboard grid layout ────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 768px) {
  .dashboard-grid {
    grid-template-columns: minmax(280px, 340px) 1fr;
    align-items: start;
  }
}
@media (min-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: minmax(300px, 360px) 1fr;
  }
}
.dashboard-sidebar { display: flex; flex-direction: column; gap: 1rem; }
.dashboard-main    { display: flex; flex-direction: column; gap: 1rem; }

/* ── Quick Stats Row ──────────────────────────────────────── */
.quick-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
}
@media (min-width: 640px) {
  .quick-stats { grid-template-columns: repeat(4, 1fr); }
}

/* ── Responsive table fallback ────────────────────────────── */
@media (max-width: 640px) {
  .admin-table thead { display: none; }
  .admin-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .5rem 1rem;
    border-bottom: none;
  }
  .admin-table td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: .75rem;
    color: var(--text-lighter);
    text-transform: uppercase;
    letter-spacing: .04em;
  }
  .admin-table tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: .75rem;
    overflow: hidden;
  }
  .bg-selector { grid-template-columns: repeat(4, 1fr); }
  .urgency-selector { flex-wrap: wrap; }
  .fab {
    bottom: 1rem;
    right: 1rem;
    width: 48px; height: 48px;
    font-size: 1.25rem;
  }
}

/* ── Responsive: request card on narrow mobile ────────────── */
@media (max-width: 480px) {
  .request-card-header { padding: .875rem 1rem .625rem; gap: .625rem; }
  .request-card-footer { padding: .625rem 1rem; flex-direction: column; align-items: flex-start; }
  .request-card-actions { width: 100%; justify-content: flex-end; }
  .request-hospital { font-size: .9375rem; }

  /* Donor card tighter */
  .donor-card { padding: 1rem; }

  /* Leaderboard item tighter */
  .lb-item { padding: .75rem .875rem; gap: .75rem; }
  .lb-avatar { width: 36px; height: 36px; font-size: .9375rem; }
  .lb-score-num { font-size: 1.125rem; }

  /* Profile stats card */
  .profile-stats-card .stats-grid { grid-template-columns: repeat(3, 1fr); gap: .5rem; }
  .profile-stat-num { font-size: 1.375rem; }

  /* Notification item tighter */
  .notif-item { padding: .875rem 1rem; }
  .notif-icon-wrap { width: 36px; height: 36px; font-size: 1rem; }
}

@media (max-width: 375px) {
  .request-card-footer { gap: .5rem; }
  .lb-rank { width: 28px; height: 28px; font-size: .75rem; }
  .lb-name { font-size: .875rem; }
  .bg-selector { gap: .25rem; }
  .bg-option { padding: .5rem .125rem; font-size: .8125rem; }
}
