/* ============================================================
   Sistem Manajemen Donor Darah — Custom CSS
   ============================================================ */

:root {
  --primary:        #c0392b;
  --primary-dark:   #962d22;
  --primary-light:  #e74c3c;
  --accent:         #e74c3c;
  --sidebar-bg:     #1a1a2e;
  --sidebar-width:  240px;
  --navbar-height:  60px;
  --text-primary:   #1e293b;
  --text-secondary: #64748b;
  --bg-light:       #f1f5f9;
  --card-shadow:    0 2px 12px rgba(0,0,0,0.08);
  --border-radius:  10px;
  --transition:     0.2s ease;
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-light);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
}

/* ---- NAVBAR ---- */
#mainNavbar {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%) !important;
  height: var(--navbar-height);
  box-shadow: 0 2px 16px rgba(192,57,43,0.3);
  z-index: 1050;
}

.brand-icon {
  background: rgba(255,255,255,0.2);
  border-radius: 8px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}

.brand-text {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.3px;
}

.nav-text {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
}

/* ---- NAVBAR DROPDOWN STYLING ---- */
.navbar .dropdown-menu {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12) !important;
  padding: 0.4rem 0;
  min-width: 220px;
}

.navbar .dropdown-item {
  font-size: 0.86rem;
  padding: 0.6rem 1.15rem;
  display: flex;
  align-items: center;
  color: var(--text-primary);
  font-weight: 500;
  transition: all 0.15s ease;
}

.navbar .dropdown-item:hover {
  background-color: #fdf2f2;
  color: #c0392b;
}

.navbar .dropdown-item.active {
  background-color: #fce8e6;
  color: #c0392b;
  font-weight: 700;
}

.navbar .dropdown-toggle::after {
  vertical-align: middle;
  margin-left: 0.35rem;
}

/* ---- APP WRAPPER ---- */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  padding-top: var(--navbar-height);
}

/* ---- SIDEBAR ---- */
.sidebar {
  display: none !important;
}

/* ---- MAIN CONTENT ---- */
.main-content {
  flex: 1;
  margin-left: 0 !important;
  padding: 1rem 0;
  min-height: calc(100vh - 80px);
}

/* ---- PAGE HEADER ---- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.3;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin: 0.2rem 0 0;
}

/* ---- CARDS ---- */
.card {
  border: none;
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  background: #fff;
}

.card-header {
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  font-weight: 600;
  padding: 1rem 1.25rem;
  border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
}

/* ---- STAT CARDS ---- */
.stat-card {
  display: block;
  position: relative;
  background: #ffffff;
  border-radius: 12px;
  padding: 1.25rem 1.25rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  text-decoration: none !important;
  color: inherit !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.stat-card .stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.25rem;
  color: #1e293b;
}

.stat-card .stat-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #64748b;
  text-transform: none;
}

.stat-card .stat-icon {
  position: absolute;
  right: 1.25rem;
  bottom: 1.15rem;
  font-size: 2.25rem;
  line-height: 1;
  opacity: 0.2;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.stat-card:hover .stat-icon {
  opacity: 0.35;
  transform: scale(1.08);
}

/* Color theme accents for stat cards */
.stat-card.bg-red {
  border-left: 4px solid #c0392b;
}
.stat-card.bg-red .stat-value {
  color: #c0392b;
}
.stat-card.bg-red .stat-icon {
  color: #c0392b;
}

.stat-card.bg-blue {
  border-left: 4px solid #2563eb;
}
.stat-card.bg-blue .stat-value {
  color: #2563eb;
}
.stat-card.bg-blue .stat-icon {
  color: #2563eb;
}

.stat-card.bg-green {
  border-left: 4px solid #16a34a;
}
.stat-card.bg-green .stat-value {
  color: #16a34a;
}
.stat-card.bg-green .stat-icon {
  color: #16a34a;
}

.stat-card.bg-orange {
  border-left: 4px solid #ea580c;
}
.stat-card.bg-orange .stat-value {
  color: #ea580c;
}
.stat-card.bg-orange .stat-icon {
  color: #ea580c;
}

/* ---- STOK GOLONGAN DARAH GRID ---- */
.blood-type-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

@media (max-width: 768px) {
  .blood-type-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.blood-badge {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1.25rem 0.75rem;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.blood-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.blood-type-label {
  font-size: 1.5rem;
  font-weight: 800;
  color: #c0392b;
  margin-bottom: 0.15rem;
}

.blood-stock {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: #1e293b;
}

.blood-unit {
  font-size: 0.75rem;
  font-weight: 500;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 0.25rem;
}

.blood-badge.stock-ok {
  border-color: #bbf7d0;
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 60%);
}

.blood-badge.stock-low {
  border-color: #fef08a;
  background: linear-gradient(180deg, #fefce8 0%, #ffffff 60%);
}

.blood-badge.stock-empty {
  border-color: #e2e8f0;
  background: #f8fafc;
  opacity: 0.85;
}

.blood-badge.stock-empty .blood-type-label,
.blood-badge.stock-empty .blood-stock {
  color: #94a3b8;
}

/* Expiry alerts in dashboard */
.expiry-alert {
  background: #fffbeb;
  border: 1px solid #fef3c7;
  border-left: 4px solid #f59e0b;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.5rem;
}

.expiry-alert.expiry-critical {
  background: #fef2f2;
  border-color: #fee2e2;
  border-left-color: #ef4444;
}


/* ---- TABLES ---- */
.table-card {
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  background: #fff;
}

.table > thead > tr > th {
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  padding: 0.75rem 1rem;
}

.table > tbody > tr > td {
  padding: 0.75rem 1rem;
  vertical-align: middle;
  font-size: 0.875rem;
  border-bottom: 1px solid #f1f5f9;
}

.table > tbody > tr:last-child > td { border-bottom: none; }
.table > tbody > tr:hover > td { background: #f8fafc; }

/* ---- STATUS BADGES ---- */
.badge-lolos {
  background: #dcfce7;
  color: #16a34a;
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-tidak-lolos {
  background: #fee2e2;
  color: #dc2626;
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-tersedia {
  background: #dbeafe;
  color: #1d4ed8;
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-kadaluarsa {
  background: #fee2e2;
  color: #dc2626;
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-warning-exp {
  background: #fef3c7;
  color: #d97706;
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
}

/* ---- FORMS ---- */
.form-label { font-weight: 600; font-size: 0.875rem; color: var(--text-primary); margin-bottom: 0.3rem; }
.form-control, .form-select {
  border-radius: 8px;
  border: 1.5px solid #e2e8f0;
  font-size: 0.875rem;
  padding: 0.5rem 0.85rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(192,57,43,0.12);
}

.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }

/* Checklist card */
.checklist-item {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.875rem 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  transition: all var(--transition);
}

.checklist-item:hover { border-color: var(--primary); background: #fff5f5; }
.checklist-item.checked { border-color: #ef4444; background: #fff5f5; }
.checklist-item input[type="checkbox"] { margin-top: 2px; flex-shrink: 0; }
.checklist-item .item-text { font-size: 0.875rem; }
.checklist-item .item-note { font-size: 0.78rem; color: var(--text-secondary); margin-top: 0.15rem; }

/* ---- BUTTONS ---- */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-sm { font-size: 0.78rem; padding: 0.3rem 0.7rem; border-radius: 6px; }

/* ---- ALERTS (expiry) ---- */
.expiry-alert {
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  border-left: 4px solid #f97316;
  border-radius: 8px;
  padding: 0.875rem 1rem;
  margin-bottom: 0.5rem;
}

.expiry-critical {
  background: linear-gradient(135deg, #fff5f5, #fee2e2);
  border-left: 4px solid #ef4444;
}

/* ---- LOGIN PAGE ---- */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1a2e 0%, #c0392b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: rgba(255,255,255,0.97);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.3);
}

.login-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-logo .logo-icon {
  width: 70px; height: 70px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
  font-size: 2rem;
  color: #fff;
  box-shadow: 0 8px 24px rgba(192,57,43,0.3);
}

/* ---- SEARCH BAR ---- */
.search-bar {
  position: relative;
}
.search-bar .bi {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
}
.search-bar input {
  padding-left: 2.25rem;
}

/* ---- PAGINATION ---- */
.pagination { margin: 0; }
.page-link {
  border-radius: 6px !important;
  margin: 0 2px;
  border-color: #e2e8f0;
  color: var(--text-primary);
  font-size: 0.85rem;
}
.page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 1rem; }
  .blood-type-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---- PRINT ---- */
@media print {
  .sidebar, #mainNavbar, .no-print, .btn, .pagination { display: none !important; }
  .main-content { margin: 0; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  body { background: white; }
}

/* ---- DONOR COMBOBOX / LIVE SEARCH ---- */
#donorComboboxWrapper .input-group {
  border-radius: 8px;
  overflow: hidden;
}
#donorComboboxWrapper .form-control:focus {
  box-shadow: none;
  border-color: #dee2e6;
}
.donor-dropdown-item {
  cursor: pointer;
  transition: background-color 0.15s ease, border-left-color 0.15s ease;
  border-left: 3px solid transparent !important;
}
.donor-dropdown-item:hover,
.donor-dropdown-item.key-highlighted {
  background-color: #fdf2f2 !important;
  border-left-color: #c0392b !important;
}
.donor-dropdown-item.active-item {
  background-color: #fce8e6 !important;
  border-left-color: #962d22 !important;
}
#donorDropdownList mark {
  border-radius: 3px;
  padding: 1px 3px;
}

