/**
 * FUNKY ADMIN CONSOLE STYLESHEET
 */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --admin-bg: #F4F6F3;
  --admin-sidebar-bg: #14241D;
  --admin-sidebar-hover: #1E3329;
  --admin-primary: #1E3329;
  --admin-accent: #C6A052;
  --admin-surface: #FFFFFF;
  --admin-border: #E2E8E0;
  --admin-text: #19261F;
  --admin-muted: #64748B;
  --font-admin: 'Plus Jakarta Sans', sans-serif;
}

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

body {
  font-family: var(--font-admin);
  background-color: var(--admin-bg);
  color: var(--admin-text);
  font-size: 13.5px;
  line-height: 1.5;
  min-height: 100vh;
}

/* Admin shell: the page itself never scrolls. The sidebar stays fixed and
   only the right-hand column (.admin-main) scrolls. */
.admin-body {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

.admin-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.admin-sidebar {
  width: 250px;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background-color: var(--admin-sidebar-bg);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: 'Cinzel', serif;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 3px;
  color: #FFFFFF;
}

.brand-badge {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--admin-accent);
  text-transform: uppercase;
  margin-top: 2px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #CBD5E1;
  transition: all 0.2s ease;
}

.nav-item:hover, .nav-item.active {
  background-color: var(--admin-sidebar-hover);
  color: #FFFFFF;
}

.nav-item.active {
  font-weight: 700;
  border-left: 3px solid var(--admin-accent);
}

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

.admin-user-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #94A3B8;
}

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

.admin-topbar {
  height: 64px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 40;
  background-color: var(--admin-surface);
  border-bottom: 1px solid var(--admin-border);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

/* Stat Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

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

.stat-card {
  background-color: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

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

.stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--admin-primary);
  line-height: 1.1;
}

.stat-sub {
  font-size: 11.5px;
  color: var(--admin-muted);
  margin-top: 6px;
}

/* Tables */
.card-table {
  background-color: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  margin-bottom: 28px;
}

.table-header-bar {
  padding: 16px 20px;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.table-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--admin-text);
}

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

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

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

.admin-table tr:hover td {
  background-color: #F8FAFC;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.badge-paid { background: #DCFCE7; color: #166534; }
.badge-pending { background: #FEF3C7; color: #92400E; }
.badge-failed { background: #FEE2E2; color: #991B1B; }

.badge-confirmed { background: #E0E7FF; color: #3730A3; }
.badge-dispatched { background: #F3E8FF; color: #6B21A8; }
.badge-out { background: #FFEDD5; color: #9A3412; }
.badge-delivered { background: #DCFCE7; color: #166534; }
.badge-cancelled { background: #F1F5F9; color: #475569; }

/* Buttons */
.btn-admin {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.btn-admin-primary {
  background: var(--admin-primary);
  color: #FFFFFF;
}

.btn-admin-primary:hover {
  background: #14241D;
}

.btn-admin-outline {
  background: transparent;
  border-color: var(--admin-border);
  color: var(--admin-text);
}

.btn-admin-outline:hover {
  background: #F1F5F9;
}

.btn-admin-danger {
  background: #FEE2E2;
  color: #991B1B;
}

.btn-admin-danger:hover {
  background: #FCA5A5;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--admin-text);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  background-color: var(--admin-surface);
  font-family: var(--font-admin);
  font-size: 13.5px;
  color: var(--admin-text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(30, 51, 41, 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.form-card {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  margin-bottom: 24px;
}

/* Pagination */
.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-top: 1px solid var(--admin-border);
  background: var(--admin-surface);
}

.pagination-links {
  display: flex;
  gap: 6px;
}

.page-btn {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--admin-border);
  background: var(--admin-surface);
  color: var(--admin-text);
}

.page-btn.active {
  background: var(--admin-primary);
  color: #FFFFFF;
  border-color: var(--admin-primary);
}

/* ------------------------------------------------------------------
   Small screens: stack the shell so the sidebar becomes a scrollable
   top bar and the page scrolls normally (no clipped content).
   ------------------------------------------------------------------ */
@media (max-width: 860px) {
  .admin-body {
    height: auto;
    overflow: visible;
  }

  .admin-layout {
    display: block;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .admin-sidebar {
    width: 100%;
    height: auto;
    overflow: visible;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .sidebar-brand {
    padding: 14px 18px;
  }

  .sidebar-nav {
    flex-direction: row;
    flex: none;
    gap: 6px;
    padding: 10px 12px;
    overflow-x: auto;
  }

  .nav-item {
    white-space: nowrap;
    padding: 9px 12px;
  }

  .nav-item.active {
    border-left: none;
    border-bottom: 2px solid var(--admin-accent);
  }

  .sidebar-footer {
    padding: 10px 18px;
  }

  .admin-main {
    height: auto;
    overflow: visible;
  }

  .admin-topbar {
    position: static;
    height: auto;
    min-height: 60px;
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .admin-content {
    padding: 18px 16px;
  }
}

@media (max-width: 860px) {
  .admin-detail-layout {
    grid-template-columns: 1fr !important;
  }
}
