/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: #f0f2f5; color: #333; line-height: 1.5; }
img { max-width: 100%; display: block; }
a { color: #1e5a9f; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Variables ────────────────────────────────────────────────────────────── */
:root {
  --primary: #1e5a9f;
  --primary-dark: #154070;
  --primary-light: #2e75b6;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #ff9800;
  --sidebar-w: 240px;
  --transition: 0.18s ease;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border: none; border-radius: 6px; font-size: 14px;
  font-weight: 600; cursor: pointer; transition: background var(--transition), transform var(--transition);
  white-space: nowrap; text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #218838; text-decoration: none; color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-danger:hover  { background: #c82333; text-decoration: none; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #e68900; text-decoration: none; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 5px; color: #444; font-size: 14px; }
.form-control {
  width: 100%; padding: 9px 12px; border: 1px solid #ccc; border-radius: 6px;
  font-size: 14px; transition: border-color var(--transition), box-shadow var(--transition);
  background: #fff;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,90,159,0.15); }
select.form-control { cursor: pointer; }

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-error   { background: #ffebee; color: #c62828; border-left: 4px solid var(--danger); }
.alert-success { background: #e8f5e9; color: #2e7d32; border-left: 4px solid var(--success); }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card { background: #fff; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.07); overflow: hidden; }
.card-header { padding: 16px 20px; border-bottom: 1px solid #eee; font-weight: 700; color: var(--primary); font-size: 16px; }
.card-body { padding: 20px; }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
table th { background: var(--primary); color: #fff; padding: 11px 14px; text-align: left; white-space: nowrap; }
table td { padding: 10px 14px; border-bottom: 1px solid #eee; vertical-align: middle; }
table tbody tr:hover { background: #f5f8ff; }
table tbody tr:last-child td { border-bottom: none; }

/* ── Login / Auth pages ───────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  padding: 20px;
}
.auth-box {
  background: #fff; border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  width: 100%; max-width: 420px; padding: 36px 32px;
}
.auth-box .logo { text-align: center; margin-bottom: 20px; }
.auth-box .logo img { height: 72px; margin: 0 auto; }
.auth-box h1 { color: var(--primary); text-align: center; font-size: 20px; margin-bottom: 4px; }
.auth-box h2 { color: #555; text-align: center; font-size: 16px; margin-bottom: 24px; font-weight: 400; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 13px; color: #666; }
.auth-footer a { color: var(--primary); margin: 0 4px; }

/* ── Admin sidebar layout ─────────────────────────────────────────────────── */
.admin-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh; z-index: 200;
  transition: transform var(--transition);
  overflow-y: auto;
}
.sidebar-header { padding: 18px 16px; text-align: center; border-bottom: 1px solid rgba(255,255,255,0.12); }
.sidebar-header img { height: 56px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.6); margin: 0 auto 8px; }
.sidebar-header h2 { font-size: 13px; opacity: 0.95; margin: 0; }
.sidebar-header h3 { font-size: 11px; opacity: 0.7; margin: 3px 0 0; font-weight: 400; }
.sidebar-menu { flex: 1; padding: 12px 0; }
.sidebar-menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; color: rgba(255,255,255,0.82); font-size: 14px;
  border-left: 3px solid transparent; transition: all var(--transition);
  text-decoration: none;
}
.sidebar-menu a:hover, .sidebar-menu a.active {
  background: rgba(255,255,255,0.12); color: #fff; border-left-color: #ffd700;
  text-decoration: none;
}
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,0.12); }
.sidebar-footer a {
  display: block; padding: 10px; text-align: center;
  background: rgba(220,53,69,0.25); color: #fff; border-radius: 6px;
  font-size: 14px; font-weight: 600; transition: background var(--transition);
  text-decoration: none;
}
.sidebar-footer a:hover { background: rgba(220,53,69,0.5); text-decoration: none; }

/* Hamburger */
.hamburger {
  display: none; position: fixed; top: 12px; left: 12px; z-index: 300;
  background: var(--primary); color: #fff; border: none; border-radius: 6px;
  width: 40px; height: 40px; font-size: 20px; cursor: pointer;
  align-items: center; justify-content: center;
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 199;
}

.admin-main { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; }

/* ── Admin page content ───────────────────────────────────────────────────── */
.page-content { padding: 24px; max-width: 1100px; }
.page-title { color: var(--primary); font-size: 22px; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }
.section-card { background: #fff; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); padding: 22px; margin-bottom: 24px; }
.section-card h3 { color: var(--primary); font-size: 16px; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid #eee; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hamburger { display: flex; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .admin-main { margin-left: 0; }
  .page-content { padding: 16px; padding-top: 60px; }
  .auth-box { padding: 28px 20px; }
  table th, table td { padding: 8px 10px; font-size: 13px; }
  .btn { padding: 8px 14px; font-size: 13px; }
}
@media (max-width: 480px) {
  .auth-box { padding: 24px 16px; }
  .auth-box h1 { font-size: 17px; }
}
