/* ============================================
   MPHG Admin Panel CSS
   ============================================ */
:root {
  --primary:  #C8302A;
  --navy:     #0D1B3E;
  --navy-l:   #152650;
  --surface:  #F4F6F8;
  --sidebar-w: 260px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--surface);
  color: #1a1a2e;
  font-size: 14px;
}

/* ---- Sidebar ---- */
.admin-sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex; flex-direction: column;
  z-index: 100; transition: transform 0.3s;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo .logo-text { font-size: 1.1rem; font-weight: 900; color: #fff; letter-spacing: -0.5px; }
.sidebar-logo .logo-text span { color: var(--primary); }
.sidebar-logo .sub { font-size: 0.7rem; color: rgba(255,255,255,0.4); margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 1rem 0; }
.sidebar-section-title {
  padding: 0.75rem 1.25rem 0.25rem;
  font-size: 0.65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: rgba(255,255,255,0.3);
}
.sidebar-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 1.25rem;
  color: rgba(255,255,255,0.65);
  text-decoration: none; font-size: 0.875rem; font-weight: 500;
  transition: all 0.2s; border-left: 3px solid transparent;
}
.sidebar-link:hover { color: #fff; background: rgba(255,255,255,0.07); }
.sidebar-link.active { color: #fff; background: rgba(200,48,42,0.2); border-left-color: var(--primary); }
.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-link .badge {
  margin-left: auto; background: var(--primary); color: #fff;
  font-size: 0.65rem; font-weight: 700; padding: 2px 7px; border-radius: 9999px;
}

/* ---- Main Content Area ---- */
.admin-main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.admin-topbar {
  background: #fff; height: 60px;
  padding: 0 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #e5e7eb;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.admin-topbar h1 { font-size: 1.1rem; font-weight: 700; color: #1a1a2e; }
.admin-topbar .user-info { display:flex; align-items:center; gap:0.75rem; }
.admin-topbar .user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.875rem;
}
.admin-topbar .user-name { font-size: 0.875rem; font-weight: 600; }
.admin-topbar .logout-btn {
  padding: 0.375rem 0.875rem; border-radius: 0.5rem;
  background: #fee2e2; color: var(--primary);
  font-size: 0.8rem; font-weight: 600; text-decoration: none;
  transition: background 0.2s;
}
.admin-topbar .logout-btn:hover { background: var(--primary); color: #fff; }

.admin-content { padding: 1.5rem; flex: 1; }

/* ---- Stats Cards ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.25rem; margin-bottom: 1.5rem; }
.stat-card {
  background: #fff; border-radius: 0.875rem; padding: 1.25rem 1.5rem;
  display: flex; align-items: center; gap: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06); transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-icon {
  width: 48px; height: 48px; border-radius: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon.red   { background: #fee2e2; color: var(--primary); }
.stat-icon.blue  { background: #dbeafe; color: #2563eb; }
.stat-icon.green { background: #d1fae5; color: #059669; }
.stat-icon.amber { background: #fef3c7; color: #d97706; }
.stat-icon svg   { width: 24px; height: 24px; }
.stat-info .label { font-size: 0.8rem; color: #6b7280; font-weight: 500; }
.stat-info .value { font-size: 1.6rem; font-weight: 800; color: #1a1a2e; line-height: 1; margin-top: 2px; }
.stat-info .change { font-size: 0.75rem; margin-top: 3px; font-weight: 600; }
.stat-info .change.up   { color: #059669; }
.stat-info .change.down { color: var(--primary); }

/* ---- Tables ---- */
.admin-table-wrap { background: #fff; border-radius: 0.875rem; box-shadow: 0 2px 8px rgba(0,0,0,0.06); overflow: hidden; }
.admin-table-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid #f3f4f6; display:flex; align-items:center; justify-content:space-between; }
.admin-table-header h2 { font-size: 1rem; font-weight: 700; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { background: var(--surface); padding: 0.75rem 1rem; text-align: left; font-size: 0.75rem; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px; }
.admin-table td { padding: 0.875rem 1rem; border-bottom: 1px solid #f9fafb; font-size: 0.875rem; vertical-align: middle; }
.admin-table tbody tr:hover { background: #fafafa; }
.admin-table tbody tr:last-child td { border-bottom: none; }

/* ---- Badges ---- */
.badge-status {
  padding: 3px 10px; border-radius: 9999px; font-size: 0.72rem; font-weight: 700;
}
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-amber  { background: #fef3c7; color: #92400e; }
.badge-blue   { background: #dbeafe; color: #1e40af; }

/* ---- Action Buttons ---- */
.btn-primary {
  background: var(--primary); color: #fff;
  padding: 0.5rem 1.25rem; border-radius: 0.5rem;
  font-size: 0.875rem; font-weight: 600; border: none; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; gap: 0.4rem;
  transition: background 0.2s;
}
.btn-primary:hover { background: #a02020; }
.btn-secondary {
  background: var(--surface); color: #374151;
  padding: 0.5rem 1.25rem; border-radius: 0.5rem;
  font-size: 0.875rem; font-weight: 600; border: 1px solid #e5e7eb; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; gap: 0.4rem;
  transition: background 0.2s;
}
.btn-secondary:hover { background: #e5e7eb; }
.btn-danger {
  background: #fee2e2; color: var(--primary);
  padding: 0.375rem 0.75rem; border-radius: 0.375rem;
  font-size: 0.8rem; font-weight: 600; border: none; cursor: pointer;
  transition: all 0.2s;
}
.btn-danger:hover { background: var(--primary); color: #fff; }
.btn-edit {
  background: #dbeafe; color: #1d4ed8;
  padding: 0.375rem 0.75rem; border-radius: 0.375rem;
  font-size: 0.8rem; font-weight: 600; text-decoration: none;
  transition: all 0.2s;
}
.btn-edit:hover { background: #1d4ed8; color: #fff; }
.btn-view { background:#d1fae5; color:#065f46; padding:0.375rem 0.75rem; border-radius:0.375rem; font-size:0.8rem; font-weight:600; text-decoration:none; transition:all 0.2s; }
.btn-view:hover { background:#065f46; color:#fff; }

/* ---- Forms ---- */
.admin-form-group { margin-bottom: 1.25rem; }
.admin-form-group label { display: block; font-size: 0.875rem; font-weight: 600; color: #374151; margin-bottom: 0.4rem; }
.admin-form-group input[type="text"],
.admin-form-group input[type="email"],
.admin-form-group input[type="password"],
.admin-form-group input[type="date"],
.admin-form-group input[type="number"],
.admin-form-group select,
.admin-form-group textarea {
  width: 100%; padding: 0.625rem 0.875rem; border: 1.5px solid #e5e7eb;
  border-radius: 0.5rem; font-size: 0.875rem; outline: none;
  font-family: inherit; transition: border-color 0.2s;
}
.admin-form-group input:focus,
.admin-form-group select:focus,
.admin-form-group textarea:focus { border-color: var(--primary); }
.admin-form-group textarea { resize: vertical; min-height: 100px; }

/* ---- Login Page ---- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, #1e3a6e 100%);
}
.login-card {
  background: #fff; border-radius: 1.25rem; padding: 2.5rem;
  width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo { text-align: center; margin-bottom: 1.75rem; }
.login-logo .brand { font-size: 1.6rem; font-weight: 900; color: var(--primary); letter-spacing: -1px; }
.login-logo .sub { font-size: 0.8rem; color: #6b7280; margin-top: 4px; }
.login-card h2 { font-size: 1.3rem; font-weight: 800; color: #1a1a2e; margin-bottom: 0.25rem; }
.login-card p.subtitle { font-size: 0.875rem; color: #6b7280; margin-bottom: 1.5rem; }
.login-btn {
  width: 100%; background: var(--primary); color: #fff;
  padding: 0.875rem; border-radius: 0.625rem; font-size: 0.95rem; font-weight: 700;
  border: none; cursor: pointer; font-family: inherit; transition: background 0.2s;
}
.login-btn:hover { background: #a02020; }
.login-error { background: #fee2e2; color: #991b1b; padding: 0.75rem 1rem; border-radius: 0.5rem; font-size: 0.875rem; margin-bottom: 1rem; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
