/* ==========================================================================
   OPTIMA HEALTHCARE SERVICES - ADMIN PANEL STYLESHEET
   Brand Palette: Deep Medical Navy (#0e2246) & Medical Crimson Red (#cc1e28)
   ========================================================================== */

:root {
  --admin-sidebar-bg: #07152d;
  --admin-sidebar-active: #0e2246;
  --admin-primary: #0e2246;
  --admin-primary-light: #1b3d75;
  --admin-accent: #cc1e28;
  --admin-accent-hover: #a8151d;
  --admin-accent-soft: #fef2f2;
  --admin-body-bg: #f8fafc;
  --admin-card-bg: #ffffff;
  --admin-text-main: #0f172a;
  --admin-text-muted: #64748b;
  --admin-border: #e2e8f0;
  --admin-success: #059669;
  --admin-warning: #d97706;
  --admin-danger: #cc1e28;
}

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

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background-color: var(--admin-body-bg);
  color: var(--admin-text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ==========================================================================
   LOGIN & AUTH OVERLAY (Shown when not authenticated)
   ========================================================================== */
#authOverlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top right, #1b3d75 0%, #07152d 100%);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-header {
  background: var(--admin-primary);
  padding: 30px 24px;
  text-align: center;
  color: #ffffff;
}

.auth-logo-img {
  height: 52px;
  width: auto;
  margin-bottom: 12px;
}

.auth-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.auth-sub {
  font-size: 0.8125rem;
  color: #fca5a5;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}

.auth-body {
  padding: 32px 28px;
}

.auth-form-group {
  margin-bottom: 20px;
}

.auth-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-family: inherit;
  transition: all 0.2s;
}

.auth-input:focus {
  outline: none;
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(14, 34, 70, 0.12);
}

.btn-auth-submit {
  width: 100%;
  padding: 13px;
  background-color: var(--admin-primary);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-auth-submit:hover {
  background-color: #173468;
}

.auth-links-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  font-size: 0.8125rem;
}

.auth-link {
  color: var(--admin-accent);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.8125rem;
  margin-bottom: 18px;
  display: none;
}

.auth-alert.error {
  display: block;
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.auth-alert.success {
  display: block;
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* ==========================================================================
   SIDEBAR & MAIN LAYOUT
   ========================================================================== */
.admin-sidebar {
  width: 260px;
  background-color: var(--admin-sidebar-bg);
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid rgba(255,255,255,0.06);
  min-height: 100vh;
}

.sidebar-brand {
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand img {
  height: 42px;
  width: auto;
  background: transparent;
}

.sidebar-brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #ffffff;
  text-transform: uppercase;
  line-height: 1.1;
}

.sidebar-brand-sub {
  font-size: 0.6875rem;
  color: #fca5a5;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 700;
}

.sidebar-menu {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #cbd5e1;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

.menu-item:hover {
  background-color: rgba(255,255,255,0.06);
  color: #ffffff;
}

.menu-item.active {
  background-color: var(--admin-accent);
  color: #ffffff;
  font-weight: 700;
}

.menu-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.menu-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.2);
  color: #ffffff;
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 9999px;
  font-weight: 700;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-footer a {
  color: #94a3b8;
  font-size: 0.8125rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.sidebar-footer a:hover {
  color: #ffffff;
}

/* Main Content */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
}

/* Topbar */
.admin-topbar {
  background-color: #ffffff;
  height: 70px;
  border-bottom: 1px solid var(--admin-border);
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--admin-primary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-topbar-action {
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  transition: all 0.15s;
}

.btn-topbar-action:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.btn-topbar-logout {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.btn-topbar-logout:hover {
  background: #fee2e2;
  color: #991b1b;
}

/* Admin Body */
.admin-body {
  padding: 30px;
  flex: 1;
}

/* KPI Stats Strip */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background-color: var(--admin-card-bg);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}

.stat-label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--admin-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.stat-val {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--admin-text-main);
  line-height: 1;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background-color: #edf3fb;
  color: var(--admin-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Quick Actions in Dashboard */
.quick-actions-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.btn-quick-action {
  padding: 10px 18px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--admin-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-quick-action:hover {
  background: var(--admin-primary);
  color: #ffffff;
  border-color: var(--admin-primary);
}

/* Content Cards */
.content-card {
  background-color: var(--admin-card-bg);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.02);
  margin-bottom: 24px;
}

.card-header-flex {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--admin-border);
}

.card-header-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--admin-primary);
}

.btn-add {
  background-color: var(--admin-accent);
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.2s;
}

.btn-add:hover {
  background-color: var(--admin-accent-hover);
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.admin-table th {
  background-color: #f8fafc;
  padding: 12px 18px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--admin-text-muted);
  border-bottom: 1px solid var(--admin-border);
  letter-spacing: 0.5px;
}

.admin-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--admin-border);
  font-size: 0.875rem;
  vertical-align: middle;
}

.admin-table tbody tr:hover {
  background-color: #f8fafc;
}

/* Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.active,
.status-badge.autoconfirmed,
.status-badge.responded {
  background-color: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.status-badge.inactive,
.status-badge.cancelled {
  background-color: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.status-badge.new {
  background-color: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.repeat-badge {
  display: inline-block;
  background-color: #fef2f2;
  color: var(--admin-accent);
  border: 1px solid #fecaca;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  margin-left: 6px;
}

/* Gallery Grid in Admin */
.admin-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  padding: 24px;
}

.admin-gallery-card {
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  overflow: hidden;
  background: #ffffff;
  transition: transform 0.2s, box-shadow 0.2s;
}

.admin-gallery-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}

.admin-gallery-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

.admin-gallery-info {
  padding: 14px;
}

.admin-gallery-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--admin-primary);
  margin-bottom: 4px;
  line-height: 1.3;
}

.admin-gallery-cat {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--admin-accent);
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(7, 21, 45, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  background-color: #ffffff;
  border-radius: 14px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
  animation: slideUp 0.25s ease-out;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--admin-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--admin-text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--admin-border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #334155;
  text-transform: uppercase;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.875rem;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(14, 34, 70, 0.1);
}

/* Responsive */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  body {
    flex-direction: column;
  }
  .admin-sidebar {
    width: 100%;
    min-height: auto;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
