/*
 * The Malt Admin — Styles
 */

/* ── Layout ────────────────────────────────────────────────────────────────── */
.admin-layout {
  display: flex;
  min-height: 100vh;
  background: #F1F5F9;
}

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
.admin-sidebar {
  width: 240px;
  background: #1E293B;
  color: #CBD5E1;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 200;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
  flex-shrink: 0;
}

.admin-sidebar.open {
  transform: translateX(0);
  box-shadow: 4px 0 20px rgba(0,0,0,0.3);
}

@media (min-width: 768px) {
  .admin-sidebar {
    position: sticky;
    transform: translateX(0);
    height: 100vh;
    top: 0;
  }

  .admin-main {
    margin-left: 0;
  }

  .admin-hamburger { display: none !important; }

  .admin-overlay { display: none !important; }
}

/* ── Sidebar Brand ─────────────────────────────────────────────────────────── */
.admin-sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.admin-brand-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.02em;
}

.admin-brand-badge {
  font-size: 0.65rem;
  font-weight: 600;
  background: #4F46E5;
  color: white;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-sidebar-close {
  background: none;
  border: none;
  color: #94A3B8;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.admin-sidebar-close:hover { color: white; }

/* ── Sidebar Nav ───────────────────────────────────────────────────────────── */
.admin-nav {
  flex: 1;
  padding: 0.75rem 0;
}

.admin-nav-section {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
  padding: 0.75rem 1rem 0.375rem;
}

.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #94A3B8;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.admin-nav-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.admin-nav-link:hover {
  color: #E2E8F0;
  background: rgba(255,255,255,0.05);
}

.admin-nav-link.active {
  color: #FFFFFF;
  background: rgba(79,70,229,0.2);
  border-left-color: #6366F1;
}

.admin-nav-link.active svg { opacity: 1; }

/* ── Sidebar Footer ────────────────────────────────────────────────────────── */
.admin-sidebar-footer {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 0.75rem 0;
}

.admin-signout-form { margin: 0; }

.admin-signout-btn {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #94A3B8;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s, background 0.15s;
}

.admin-signout-btn:hover {
  color: #FCA5A5;
  background: rgba(239, 68, 68, 0.1);
}

.admin-signout-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

/* ── Mobile Overlay ────────────────────────────────────────────────────────── */
.admin-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
  backdrop-filter: blur(2px);
}

.admin-overlay.visible { display: block; }

/* ── Main Area ─────────────────────────────────────────────────────────────── */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

/* ── Top Bar ───────────────────────────────────────────────────────────────── */
.admin-topbar {
  background: #FFFFFF;
  border-bottom: 1px solid #E2E8F0;
  padding: 0.875rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.admin-hamburger {
  background: none;
  border: none;
  color: #475569;
  cursor: pointer;
  padding: 0.375rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
}

.admin-hamburger:hover { background: #F1F5F9; }
.admin-hamburger svg   { width: 20px; height: 20px; }

.admin-page-title {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  color: #0F172A;
  margin: 0;
}

.admin-topbar-user {
  font-size: 0.8rem;
  font-weight: 500;
  color: #64748B;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

/* ── Content Area ──────────────────────────────────────────────────────────── */
.admin-content {
  flex: 1;
  padding: 1.5rem 1.25rem;
}

@media (min-width: 768px) {
  .admin-content { padding: 1.75rem 2rem; }
}

/* ── Flash ─────────────────────────────────────────────────────────────────── */
.admin-flash {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin: 0 1.25rem 0;
  font-size: 0.875rem;
  font-weight: 500;
}

.admin-flash-alert {
  background: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FECACA;
}

.admin-flash-notice {
  background: #F0FDF4;
  color: #16A34A;
  border: 1px solid #BBF7D0;
}

/* ── Section Group Label ───────────────────────────────────────────────────── */
.admin-section-group-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94A3B8;
  margin: 0 0 0.625rem;
}

/* ── Stat Cards ────────────────────────────────────────────────────────────── */
.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.875rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  .admin-stat-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
  .admin-stat-grid { grid-template-columns: repeat(4, 1fr); }
}

.admin-stat-card {
  background: #FFFFFF;
  border-radius: 10px;
  padding: 1.125rem 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid #F1F5F9;
}

.admin-stat-card-link {
  text-decoration: none;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
}

.admin-stat-card-link:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transform: translateY(-1px);
}

.admin-stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748B;
  margin-bottom: 0.375rem;
}

.admin-stat-value {
  font-size: 1.625rem;
  font-weight: 700;
  color: #0F172A;
  line-height: 1.1;
}

.admin-stat-sub {
  font-size: 0.75rem;
  color: #94A3B8;
  margin-top: 0.25rem;
}

/* ── Section Cards ─────────────────────────────────────────────────────────── */
.admin-section-card {
  background: #FFFFFF;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid #F1F5F9;
  overflow: hidden;
  margin-bottom: 1rem;
}

.admin-section-card-img {
  background: #FFFFFF;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid #F1F5F9;
  overflow: hidden;
  margin-bottom: 1.5rem;
  max-width: 250px;
  height: 250px;
  margin-inline: auto;
}

.admin-section-card-img img{
  object-fit: cover;
  width: 100%;
  height: 100%;
}

.admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #F1F5F9;
}

.admin-section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #0F172A;
}

/* ── Tables ────────────────────────────────────────────────────────────────── */
.admin-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.admin-table th {
  padding: 0.625rem 1rem;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748B;
  background: #F8FAFC;
  border-bottom: 1px solid #E2E8F0;
  white-space: nowrap;
}

.admin-table td {
  padding: 0.75rem 1rem;
  color: #334155;
  border-bottom: 1px solid #F1F5F9;
  vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }

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

/* ── Page Header ───────────────────────────────────────────────────────────── */
.admin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.admin-page-heading {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0F172A;
  margin: 0;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.admin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  height: 2.25rem;
  padding: 0 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, opacity 0.15s;
  font-family: inherit;
  white-space: nowrap;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

.admin-btn-primary  { background: #4F46E5; color: white; }
.admin-btn-primary:hover  { background: #3730A3; }

.admin-btn-secondary { background: #F1F5F9; color: #334155; border: 1px solid #E2E8F0; }
.admin-btn-secondary:hover { background: #E2E8F0; }

.admin-btn-danger  { background: #FEF2F2; color: #DC2626; border: 1px solid #FECACA; }
.admin-btn-danger:hover  { background: #FEE2E2; }

.admin-btn-sm {
  padding: 0 0.625rem;
  font-size: 0.8rem;
}

/* ── Badges ────────────────────────────────────────────────────────────────── */
.admin-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.admin-badge-green   { background: #DCFCE7; color: #16A34A; }
.admin-badge-red     { background: #FEE2E2; color: #DC2626; }
.admin-badge-blue    { background: #DBEAFE; color: #1D4ED8; }
.admin-badge-purple  { background: #EDE9FE; color: #7C3AED; }
.admin-badge-gray    { background: #F1F5F9; color: #64748B; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.admin-form-card {
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid #F1F5F9;
  max-width: 600px;
}

.admin-form-group { margin-bottom: 1.125rem; }

.admin-form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.375rem;
}

.admin-form-control {
  display: block;
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9rem;
  color: #111827;
  background: white;
  border: 1.5px solid #E5E7EB;
  border-radius: 7px;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  min-height: 40px;
}

.admin-form-control:focus {
  outline: none;
  border-color: #6366F1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.admin-form-control::placeholder { color: #9CA3AF; }

textarea.admin-form-control {
  min-height: 90px;
  resize: vertical;
}

.admin-form-check {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  cursor: pointer;
}

.admin-form-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #4F46E5;
  cursor: pointer;
}

.admin-form-check-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
}

.admin-form-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid #F3F4F6;
}

/* ── Search ────────────────────────────────────────────────────────────────── */
.admin-search-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.admin-search-input {
  flex: 1;
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
  color: #111827;
  background: white;
  border: 1.5px solid #E5E7EB;
  border-radius: 7px;
  font-family: inherit;
  min-height: 38px;
}

.admin-search-input:focus {
  outline: none;
  border-color: #6366F1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

/* ── Login Page ────────────────────────────────────────────────────────────── */
.admin-login-page {
  min-height: 100vh;
  background: #0F172A;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.admin-login-card {
  background: white;
  border-radius: 12px;
  padding: 2rem 1.75rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.4);
}

.admin-login-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}

.admin-login-logo h1 {
  font-size: 1.375rem;
  font-weight: 700;
  color: #0F172A;
  letter-spacing: -0.025em;
}

.admin-login-logo p {
  font-size: 0.875rem;
  color: #64748B;
  margin-top: 0.25rem;
}

/* ── User Detail ───────────────────────────────────────────────────────────── */
.admin-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.875rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  .admin-detail-grid { grid-template-columns: repeat(3, 1fr); }
}

.admin-detail-card {
  background: white;
  border-radius: 10px;
  padding: 1rem;
  border: 1px solid #F1F5F9;
}

.admin-detail-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748B;
  margin-bottom: 0.375rem;
}

.admin-detail-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: #0F172A;
  word-break: break-word;
}

/* ── Empty State ───────────────────────────────────────────────────────────── */
.admin-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: #94A3B8;
  font-size: 0.875rem;
}

/* ── Toggle Switch ─────────────────────────────────────────────────────────── */
.admin-toggle-form { display: inline-flex; margin: 0; }

.admin-toggle-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: #64748B;
  -webkit-tap-highlight-color: transparent;
}

.admin-toggle-track {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #CBD5E1;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.admin-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.2s ease;
}

.admin-toggle-btn.is-on .admin-toggle-track  { background: #22C55E; }
.admin-toggle-btn.is-on .admin-toggle-thumb  { transform: translateX(16px); }
.admin-toggle-btn.is-on                      { color: #16A34A; }

.admin-toggle-btn:hover .admin-toggle-track  { opacity: 0.85; }

/* ── Back Link ─────────────────────────────────────────────────────────────── */
.admin-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: #64748B;
  text-decoration: none;
  margin-bottom: 1.25rem;
}

.admin-back-link:hover { color: #334155; }


/* ── Pagy Pagination ────────────────────────────────────────────────────────── */
.pagy-nav-wrap {
  display: flex;
  justify-content: center;
  margin-top: 1.25rem;
}

nav.pagy {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

nav.pagy a,
nav.pagy span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  color: #475569;
  background: white;
  border: 1px solid #E2E8F0;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}

nav.pagy a:hover {
  background: #F1F5F9;
  border-color: #CBD5E1;
  color: #0F172A;
}

nav.pagy span.current {
  background: #4F46E5;
  color: white;
  border-color: #4F46E5;
}

nav.pagy span.gap,
nav.pagy span.disabled {
  background: transparent;
  border-color: transparent;
  color: #CBD5E1;
  cursor: default;
}

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.admin-tabs-nav {
  display: flex;
  border-bottom: 2px solid #E2E8F0;
  margin-bottom: 1.25rem;
  gap: 0;
}

.admin-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #64748B;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  font-family: inherit;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.admin-tab-btn:hover { color: #334155; }

.admin-tab-btn.active {
  color: #4F46E5;
  border-bottom-color: #4F46E5;
}

/* ── Payment confirm dialog ─────────────────────────────────────────────── */
#payment-confirm-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

#payment-confirm-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}
