/* ============================================================
   MILNERTON CRICKET CLUB — ADMIN STYLESHEET
   ============================================================ */
:root {
  --navy:      #1B3A6B;
  --navy-dark: #122952;
  --navy-mid:  #24508A;
  --white:     #FFFFFF;
  --gold:      #C9A84C;
  --off-white: #F0F4FA;
  --sidebar-w: 260px;
  --text:      #1a1a2e;
  --text-mid:  #4a5568;
  --border:    #d1dae8;
  --shadow:    rgba(27,58,107,0.12);
  --danger:    #dc3545;
  --success:   #28a745;
  --warning:   #ffc107;
  --info:      #17a2b8;
  --radius:    6px;
  --font:      'Source Sans 3', sans-serif;
}
*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; }
html { height:100%; }
body {
  font-family: var(--font);
  background: var(--off-white);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}
/* Admin layout wrapper — sidebar + main side by side */
body.admin-layout {
  display: flex;
}
/* Login / standalone pages — centred full-screen */
body.admin-login {
  display: flex;
  align-items: center;
  justify-content: center;
}
a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--gold); }
img { max-width: 100%; }

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--navy-dark);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 200;
  transition: transform 0.3s ease;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: var(--navy);
}
.sidebar-logo img { height: 44px; }
.sidebar-logo span {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 8px;
}
.sidebar-user {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-avatar {
  width: 32px;
  height: 32px;
  background: var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy-dark);
  font-size: 0.9rem;
  font-weight: 700;
  flex-shrink: 0;
}
.sidebar-user-info .name { color: white; font-weight: 600; font-size: 0.85rem; }
.sidebar-user-info .role { color: rgba(255,255,255,0.4); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; }

nav.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 16px 20px 6px;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: rgba(255,255,255,0.65);
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.sidebar-nav a i { width: 16px; text-align: center; font-size: 0.9rem; }
.sidebar-nav a:hover, .sidebar-nav a.active {
  color: white;
  background: rgba(255,255,255,0.07);
  border-left-color: var(--gold);
}
.sidebar-nav a.active { color: var(--gold); }
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,0.4);
  font-size: 0.82rem;
  transition: color 0.2s;
}
.sidebar-footer a:hover { color: var(--gold); }

/* ---- MAIN LAYOUT ---- */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.admin-topbar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 8px var(--shadow);
}
.admin-topbar h1 { font-size: 1.2rem; font-weight: 700; color: var(--navy); }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.topbar-badge {
  background: var(--off-white);
  border: 1px solid var(--border);
  color: var(--text-mid);
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
}
.hamburger-admin {
  display: none;
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--navy);
  cursor: pointer;
  padding: 4px;
}

.admin-content { padding: 28px; flex: 1; }

/* ---- CARDS ---- */
.card { background: white; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: 0 1px 6px var(--shadow); margin-bottom: 24px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h2 { font-size: 1rem; font-weight: 700; color: var(--navy); margin: 0; }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--off-white); }

/* ---- STAT CARDS ---- */
/* stat-cards defined in dashboard section below */
.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 6px var(--shadow);
}
.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-card-icon.blue   { background: rgba(27,58,107,0.1);  color: var(--navy); }
.stat-card-icon.gold   { background: rgba(201,168,76,0.15); color: var(--gold); }
.stat-card-icon.green  { background: rgba(40,167,69,0.1);  color: #28a745; }
.stat-card-icon.red    { background: rgba(220,53,69,0.1);  color: #dc3545; }
.stat-card-num { font-size: 1.8rem; font-weight: 700; color: var(--navy); line-height: 1; }
.stat-card-label { font-size: 0.78rem; color: var(--text-mid); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-weight: 600; font-size: 0.85rem; color:#a8a8a8; margin-bottom: 6px; }
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.88rem;
  color: var(--text);
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-control:focus { border-color: var(--navy-mid); box-shadow: 0 0 0 3px rgba(27,58,107,0.1); }
.form-control.is-invalid { border-color: var(--danger); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 120px; }
.form-hint { font-size: 0.78rem; color: var(--text-mid); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--navy); color: white; border-color: var(--navy); }
.btn-primary:hover { background: var(--navy-mid); color: white; }
.btn-secondary { background: var(--off-white); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); color: var(--text); }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { background: #218838; color: white; }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #c82333; color: white; }
.btn-warning { background: var(--warning); color: #333; border-color: var(--warning); }
.btn-gold { background: var(--gold); color: var(--navy-dark); border-color: var(--gold); }
.btn-gold:hover { background: #b8963e; color: var(--navy-dark); }
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-lg { padding: 12px 24px; font-size: 0.95rem; }

/* ---- TABLE ---- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: var(--off-white);
  padding: 10px 14px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-mid);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 0.88rem;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(27,58,107,0.02); }
.table-actions { display: flex; gap: 6px; }

/* ---- BADGES ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 50px; font-size: 0.72rem; font-weight: 700; }
.badge-success { background: #d4edda; color: #155724; }
.badge-danger  { background: #f8d7da; color: #721c24; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info    { background: #d1ecf1; color: #0c5460; }
.badge-navy    { background: rgba(27,58,107,0.1); color: var(--navy); }

/* ---- ALERTS ---- */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; font-size: 0.88rem; display: flex; align-items: flex-start; gap: 10px; border: 1px solid; }
.alert i { margin-top: 1px; flex-shrink: 0; }
.alert-success { background: #d4edda; color: #155724; border-color: #c3e6cb; }
.alert-danger  { background: #f8d7da; color: #721c24; border-color: #f5c6cb; }
.alert-info    { background: #d1ecf1; color: #0c5460; border-color: #bee5eb; }
.alert-warning { background: #fff3cd; color: #856404; border-color: #ffeeba; }

/* ---- MODAL ---- */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.active { display: flex; }
.modal { background: white; border-radius: var(--radius); max-width: 480px; width: 90%; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.modal-header { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 1rem; color: var(--navy); }
.modal-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-mid); }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ---- TinyMCE wrapper ---- */
.editor-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }

/* ---- Image Preview ---- */
.img-preview { max-width: 200px; max-height: 150px; border-radius: var(--radius); border: 1px solid var(--border); margin-top: 8px; object-fit: cover; }

/* ---- Sortable ---- */
.sortable-item { cursor: grab; }
.sortable-item:active { cursor: grabbing; }
.drag-handle { color: var(--text-mid); cursor: grab; padding: 0 6px; }

/* ---- Page ---- */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 1.3rem; font-weight: 700; color: var(--navy); }

/* ---- Login Page ---- */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-box {
  background: #203864;
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { height: 60px; margin: 0 auto 10px; }
.login-logo h1 { font-size: 1.1rem; color: var(--navy); font-weight: 700; }
.login-logo p { font-size: 0.8rem; color: #ffffff; }


/* ---- Dashboard ---- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}
.stat-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 1100px) { .stat-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .stat-cards { grid-template-columns: 1fr 1fr; } }

.quick-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---- Gallery Thumbs ---- */
.admin-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.admin-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.admin-thumb img { width: 100%; height: 100%; object-fit: cover; }
.admin-thumb .thumb-actions {
  position: absolute;
  inset: 0;
  background: rgba(18,41,82,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}
.admin-thumb:hover .thumb-actions { opacity: 1; }

/* ---- Responsive Admin ---- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .hamburger-admin { display: block; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .admin-content { padding: 16px; }
}

/* =============================================
   SUPPLEMENTAL ADMIN STYLES
   ============================================= */

/* Form grid (main + side) */
.form-grid-main { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.form-main { min-width: 0; }
.form-side { min-width: 0; }
@media (max-width: 900px) { .form-grid-main { grid-template-columns: 1fr; } }

/* Form rows */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* Form hints */
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.req { color: #e53e3e; }

/* Input prefix (for slugs) */
.input-prefix-wrap { display: flex; align-items: center; }
.input-prefix { background: var(--bg); border: 1px solid var(--border); border-right: none; padding: 8px 12px; border-radius: 6px 0 0 6px; font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.input-prefix-wrap .form-control { border-radius: 0 6px 6px 0; }

/* Alert styles */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; font-size: 14px; position: relative; }
.alert i { font-size: 16px; }
.alert-success { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }
.alert-danger  { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }
.alert-info    { background: #eff6ff; border: 1px solid #93c5fd; color: #1e40af; }
.alert-dismissible { padding-right: 40px; }
.alert-close { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; font-size: 18px; cursor: pointer; color: inherit; opacity: 0.6; }
.alert-close:hover { opacity: 1; }

/* Badge styles */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.badge-success   { background: #dcfce7; color: #166534; }
.badge-warning   { background: #fef9c3; color: #854d0e; }
.badge-danger    { background: #fee2e2; color: #991b1b; }
.badge-secondary { background: #f1f5f9; color: #64748b; }
.badge-info      { background: #dbeafe; color: #1e40af; }

/* Action buttons */
.action-btns { display: flex; gap: 6px; }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 48px; display: block; margin-bottom: 16px; opacity: 0.3; }
.empty-state p { font-size: 15px; }

/* Filter form */
.filter-form { width: 100%; }
.filter-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filter-field { flex: 1; min-width: 180px; }
.filter-field-sm { flex: 0 0 160px; }

/* Data table */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; padding: 12px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 600; border-bottom: 2px solid var(--border); background: var(--bg); }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg); }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-muted); }

/* Checkbox label */
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.checkbox-label input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); }

/* Page header */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.page-header h1 { font-size: 22px; margin: 0 0 4px; }
.page-header p { color: var(--text-muted); font-size: 14px; margin: 0; }

/* Card additions */
.card-header { padding: 14px 20px; border-bottom: 1px solid var(--border); }
.card-header h3 { margin: 0; font-size: 15px; font-weight: 600; }
.p-0 { padding: 0 !important; }
.mb-4 { margin-bottom: 24px; }
.mb-3 { margin-bottom: 16px; }
.mb-2 { margin-bottom: 10px; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.btn-block { width: 100%; justify-content: center; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* Utilities */
.text-center { text-align: center; }
ul.mb-0 { margin-bottom: 0; padding-left: 20px; }

/* Nav badge (new applications count) */
.nav-badge {
  background: var(--gold);
  color: var(--navy-dark);
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
  margin-left: auto;
  line-height: 1.6;
}

/* Colour swatch preview */
.colour-swatch {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* Opacity slider */
.opacity-slider-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
}
.opacity-slider-wrap input[type=range] {
    flex: 1;
    height: 6px;
    accent-color: var(--navy);
    cursor: pointer;
}
.opacity-val {
    font-size: 14px;
    font-weight: 700;
    color: var(--navy);
    min-width: 40px;
    text-align: right;
}
.opacity-preview-wrap {
    background: var(--navy);
    display: inline-block;
    border-radius: 8px;
    padding: 8px;
}
