/* TXTFIRE Blood Drive — Modern Theme
   White background · Purple accents · Red brand
*/

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --red-600: #dc2626;
  --red-700: #b91c1c;
  --red-800: #991b1b;
  --red-50: #fef2f2;
  --red-100: #fee2e2;

  --purple-500: #8b5cf6;
  --purple-600: #7c3aed;
  --purple-700: #6d28d9;
  --purple-100: #ede9fe;
  --purple-50: #f5f3ff;

  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px rgba(139,92,246,0.1), 0 10px 10px rgba(0,0,0,0.04);

  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  background: var(--gray-50);
  color: var(--gray-700);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Navbar ── */

.navbar {
  background: linear-gradient(135deg, var(--red-800) 0%, var(--red-600) 100%) !important;
  box-shadow: 0 2px 10px rgba(185,28,28,0.15);
  padding: 0.4rem 1rem;
  min-height: 52px;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.3px;
  color: #fff !important;
  padding-top: 0;
  padding-bottom: 0;
}

.navbar-brand i { margin-right: 0.4rem; }

.navbar .nav-link {
  color: rgba(255,255,255,0.85) !important;
  font-weight: 500;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  transition: all 0.15s ease;
}

.navbar .nav-link:hover {
  background: rgba(255,255,255,0.12);
  color: #fff !important;
}

.navbar .nav-link i { margin-right: 0.25rem; }

/* ── DB Badge ── */

.db-badge {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.db-badge i { font-size: 0.65rem; }

.db-label { opacity: 0.95; }
.db-name {
  opacity: 0.6;
  margin-left: 2px;
  font-weight: 400;
  font-size: 0.65rem;
}

.db-badge-mobile {
  background: var(--purple-100);
  color: var(--purple-700);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 0;
  letter-spacing: 0.3px;
  border-bottom: 1px solid var(--purple-200);
}

.db-name-mobile {
  opacity: 0.6;
  font-weight: 400;
  margin-left: 4px;
}

/* ── DB Switch Dropdown ── */

.db-switch-item .db-select {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  font-size: 0.75rem;
  padding: 0.25rem 1.75rem 0.25rem 0.5rem;
  min-width: 120px;
  cursor: pointer;
  border-radius: 6px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M2 5l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.4rem center;
  background-size: 12px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.db-switch-item .db-select option {
  background: var(--white);
  color: var(--gray-800);
}

.db-switch-item .db-select:focus {
  border-color: rgba(255,255,255,0.6);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.15);
}

/* ── Welcome Bar ── */

.welcome-bar {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

.welcome-bar h4 {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--gray-800);
}

.welcome-bar .form-select {
  font-size: 0.8rem;
  border-color: var(--gray-300);
  background-color: var(--white);
  color: var(--gray-700);
  padding: 0.25rem 1.75rem 0.25rem 0.5rem;
  min-width: 140px;
}

.welcome-bar .form-select:focus {
  border-color: var(--purple-500);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.15);
}

/* ── Cards ── */

.card {
  border: none;
  background: var(--white);
  box-shadow: var(--shadow);
  border-radius: var(--radius-lg);
  transition: box-shadow 0.2s ease;
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  padding: 0.875rem 1.25rem;
  font-weight: 600;
  color: var(--gray-800);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
}

.card-body { padding: 1.25rem; }

.card-footer {
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg) !important;
}

/* ── Dashboard Cards ── */

.dashboard-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  background: var(--white);
  transition: all 0.2s ease;
  cursor: pointer;
}

.dashboard-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-xl);
  border-color: var(--purple-200);
}

.dashboard-card .card-icon {
  font-size: 2.25rem;
  color: var(--purple-600);
  transition: color 0.2s ease;
}

.dashboard-card:hover .card-icon { color: var(--red-600); }

.dashboard-card h5 {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--gray-800);
  margin-bottom: 0.25rem;
}

.dashboard-card small {
  color: var(--gray-400) !important;
  font-size: 0.75rem;
}

.dashboard-card a { color: inherit; }

/* ── Buttons ── */

.btn {
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  transition: all 0.15s ease;
}

.btn-danger {
  background: var(--red-600);
  border: none;
  color: #fff;
}

.btn-danger:hover {
  background: var(--red-700);
  box-shadow: 0 4px 12px rgba(220,38,38,0.25);
  transform: translateY(-1px);
}

.btn-outline-danger {
  border: 1.5px solid var(--red-600);
  color: var(--red-600);
  background: transparent;
}

.btn-outline-danger:hover {
  background: var(--red-600);
  color: #fff;
  box-shadow: 0 4px 12px rgba(220,38,38,0.2);
}

.btn-purple {
  background: var(--purple-600);
  border: none;
  color: #fff;
}

.btn-purple:hover {
  background: var(--purple-700);
  box-shadow: 0 4px 12px rgba(124,58,237,0.25);
  transform: translateY(-1px);
}

.btn-outline-purple {
  border: 1.5px solid var(--purple-600);
  color: var(--purple-600);
  background: transparent;
}

.btn-outline-purple:hover {
  background: var(--purple-600);
  color: #fff;
}

.btn-success {
  background: #16a34a;
  border: none;
}

.btn-success:hover {
  background: #15803d;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(22,163,74,0.25);
}

.btn-warning {
  background: #ea580c;
  border: none;
  color: #fff;
}

.btn-warning:hover {
  background: #c2410c;
  color: #fff;
  transform: translateY(-1px);
}

/* ── Form Controls ── */

.form-control, .form-select {
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus, .form-select:focus {
  border-color: var(--purple-500);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.15);
  color: var(--gray-800);
  background: var(--white);
}

.form-control::placeholder { color: var(--gray-400); }

.form-label {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--gray-600);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ── Tables ── */

.table {
  color: var(--gray-700);
  font-size: 0.875rem;
  margin-bottom: 0;
}

.table thead th {
  background: var(--gray-50);
  border-bottom: 2px solid var(--purple-500);
  color: var(--gray-700);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.75rem;
}

.table tbody td {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

.table tbody tr:hover { background: var(--purple-50); }

.table-striped tbody tr:nth-of-type(odd) { background: var(--gray-50); }
.table-striped tbody tr:nth-of-type(odd):hover { background: var(--purple-50); }

/* ── Alerts ── */

.alert {
  border: none;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
}

.alert-danger {
  background: var(--red-50);
  color: var(--red-700);
  border-left: 4px solid var(--red-600);
}

.alert-success {
  background: #f0fdf4;
  color: #166534;
  border-left: 4px solid #22c55e;
}

.alert-warning {
  background: #fff7ed;
  color: #9a3412;
  border-left: 4px solid #ea580c;
}

.alert-info {
  background: var(--purple-50);
  color: var(--purple-700);
  border-left: 4px solid var(--purple-500);
}

/* ── Donor Photo ── */

.donor-photo {
  border-radius: var(--radius);
  border: 2px solid var(--gray-200);
  object-fit: contain;
  max-height: 300px;
  background: var(--gray-100);
}

.donor-photo-sm {
  border-radius: var(--radius);
  object-fit: cover;
  width: 80px;
  height: 80px;
  border: 2px solid var(--gray-200);
  background: var(--gray-100);
}

.qr-display {
  background: var(--white);
  padding: 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  display: inline-block;
}

/* ── Camera / Webcam ── */

.camera-card {
  background: var(--gray-900);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--gray-700);
}

.camera-view {
  padding: 1rem;
}

video#webcam {
  width: 100%;
  max-width: 100%;
  border-radius: var(--radius);
  background: #000;
}

canvas#photoCanvas {
  border-radius: var(--radius);
  max-width: 100%;
  background: #000;
}

/* ── Badges ── */

.shortcut-badge {
  font-size: 0.65rem;
  background: var(--purple-100);
  color: var(--purple-700);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.btn-danger .shortcut-badge, .btn-purple .shortcut-badge {
  background: rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.85);
}

.btn-outline-danger .shortcut-badge, .btn-outline-purple .shortcut-badge {
  background: transparent;
  border: 1px solid currentColor;
}

.badge {
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.35em 0.6em;
}

.bg-purple {
  background: var(--purple-600) !important;
  color: #fff;
}

/* ── Donor Info Card (transactions page) ── */

.donor-info-card {
  border: 1px solid var(--gray-200);
  background: linear-gradient(135deg, var(--purple-50), var(--white));
  border-radius: var(--radius-lg);
}

.donor-info-card .donor-name {
  font-weight: 700;
  color: var(--gray-800);
  font-size: 1.05rem;
}

/* ── Modal ── */

.modal-content {
  background: var(--white);
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
}

.modal-header {
  border-bottom: 1px solid var(--gray-200);
  padding: 1rem 1.25rem;
}

.modal-footer {
  border-top: 1px solid var(--gray-200);
  padding: 0.75rem 1.25rem;
}

/* ── Login Card ── */

.login-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.login-card .card-header {
  background: linear-gradient(135deg, var(--red-800), var(--red-600));
  color: #fff;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0 !important;
  padding: 1.5rem;
}

.login-card .card-header h4 {
  font-weight: 700;
  font-size: 1.2rem;
}

.login-card .card-header small { color: rgba(255,255,255,0.7); }

.login-card .card-body { padding: 2rem; }

/* ── Dropdown ── */

.dropdown-menu {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  padding: 0.5rem;
}

.dropdown-item {
  border-radius: var(--radius);
  padding: 0.4rem 0.75rem;
  font-weight: 500;
}

.dropdown-item:hover {
  background: var(--red-50);
  color: var(--red-700);
}

.dropdown-item i { margin-right: 0.4rem; }

/* ── Responsive ── */

@media (max-width: 991.98px) {
  .db-switch-item {
    padding-top: 0.5rem;
  }
  .db-switch-item .db-select {
    width: 100%;
    background-color: rgba(255,255,255,0.15);
  }
  .navbar-nav .nav-link {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
  }
}

@media (max-width: 767.98px) {
  .welcome-bar .d-flex { flex-direction: column; align-items: stretch !important; }
  .welcome-bar form { width: 100%; }
  .welcome-bar .form-select { width: 100% !important; }
  .dashboard-card { padding: 1.25rem !important; }
  .dashboard-card .card-icon { font-size: 1.75rem; }
  .card-body { padding: 1rem; }
  .navbar .nav-link { padding: 0.4rem 0.5rem; font-size: 0.8rem; }
  .table { font-size: 0.8rem; }
  .table thead th, .table tbody td { padding: 0.5rem; }
  .donor-photo { max-height: 200px; }
}

@media (max-width: 575.98px) {
  .container-fluid { padding-left: 0.75rem; padding-right: 0.75rem; }
  .welcome-bar { padding: 0.75rem; }
  .welcome-bar h4 { font-size: 0.95rem; }
  .login-card .card-body { padding: 1.25rem; }
  .btn-lg { font-size: 0.85rem; padding: 0.4rem 0.75rem; }
  .table thead th { font-size: 0.65rem; padding: 0.4rem; }
  .table tbody td { font-size: 0.75rem; padding: 0.4rem; }
}

/* ── Misc Utilities ── */

.text-purple { color: var(--purple-600); }
.bg-purple { background: var(--purple-600); }

code {
  background: var(--gray-100);
  color: var(--purple-700);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* Smooth scrolling */
html { scroll-behavior: smooth; }
