/* ==========================================================================
   Lucky Little Poppy - Admin Panel Styles
   Clean, modern, scaled-down dashboard layout
   ========================================================================== */

:root, [data-theme], [data-theme="poppy"], [data-theme="light"] {
  --primary-red: #E5383B;
  --primary-red-dark: #D90429;
  --primary-red-rgb: 229, 56, 59;
  --lush-green: #1B4332;
  --lush-green-light: #2D6A4F;
  --lush-green-rgb: 27, 67, 50;
  --bg-cream: #FAF7F2;
  --bg-cream-rgb: 250, 247, 242;
  --text-dark: #1A1D20;
  --text-muted: #64748B;
  --poppy-gold: #D4AF37;
  --sidebar-bg: #1A1D20;
  --sidebar-hover: rgba(250, 247, 242, 0.08);
  --sidebar-border: rgba(250, 247, 242, 0.08);
  --card-bg: #FAF7F2;
  --body-bg: #FAF7F2;
  --border-color: #E2E8F0;

  /* DaisyUI Base Overrides */
  --b1: 40 29% 97%; /* #FAF7F2 */
  --b2: 38 35% 92%; /* #F3EDE2 */
  --b3: 38 38% 85%; /* #E8DEC8 */
  --bc: 210 10% 12%; /* #1A1D20 */
}

/* Modern Slate Admin Dark Theme Variables */
[data-theme="dark"], [data-theme="slate"], html.dark, body.dark {
  --primary-red: #E5383B;
  --primary-red-dark: #D90429;
  --primary-red-rgb: 229, 56, 59;
  --lush-green: #2D6A4F;
  --lush-green-light: #40916C;
  --lush-green-rgb: 45, 106, 79;
  --bg-cream: #0F172A;
  --bg-cream-rgb: 15, 23, 42;
  --text-dark: #F8FAFC;
  --text-muted: #94A3B8;
  --poppy-gold: #D4AF37;
  --sidebar-bg: #0F172A;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --card-bg: #1E293B;
  --body-bg: #0F172A;
  --border-color: #334155;

  /* DaisyUI Dark Base Overrides */
  --b1: 222 47% 11%; /* #0F172A */
  --b2: 217 33% 17%; /* #1E293B */
  --b3: 215 25% 27%; /* #334155 */
  --bc: 210 40% 98%; /* #F8FAFC */
}

html {
  font-size: 15px;
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-cream);
  color: var(--text-dark);
  display: flex;
  min-height: 100vh;
  margin: 0;
  line-height: 1.5;
  overflow-x: hidden;
  max-width: 100vw;
}

/* Accessibility Focus States */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--primary-red) !important;
  outline-offset: 2px !important;
}

/* Sidebar Structure */
.admin-sidebar {
  width: 250px;
  background-color: var(--sidebar-bg);
  color: #FAF7F2;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  border-right: 1px solid var(--sidebar-border);
}

.sidebar-header {
  padding: 1.5rem 1.25rem 1.25rem;
  text-align: center;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo {
  max-width: 54px;
  border-radius: 50%;
  margin: 0 auto 0.625rem;
  display: block;
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.4); /* Luxury Poppy Gold ring */
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-logo:hover {
  transform: scale(1.04);
  box-shadow: 0 0 0 3px #D4AF37;
}

.sidebar-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  color: #D4AF37 !important;        /* Pure Poppy Gold Accent */
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 1rem 0.625rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 0.65rem 0.875rem;
  color: #CBD5E1;                    /* Warm, high-legibility slate text */
  text-decoration: none;
  font-weight: 500;
  font-size: 0.845rem;
  border-radius: 8px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  gap: 0.75rem;
  border-left: 3px solid transparent;
}

.nav-item .nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94A3B8;
  transition: color 0.2s ease;
}

.nav-item:hover {
  background-color: var(--sidebar-hover);
  color: #FAF7F2;
  transform: translateX(2px);
}

.nav-item:hover .nav-icon {
  color: #D4AF37;                    /* Poppy Gold hover accent */
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(229, 56, 59, 0.22) 0%, rgba(217, 4, 41, 0.14) 100%);
  color: #FAF7F2 !important;
  font-weight: 600;
  border-left: 3px solid #E5383B;   /* Vibrant Poppy Red edge */
}

.nav-item.active .nav-icon {
  color: #E5383B;                    /* Poppy Red icon */
}

.sidebar-footer {
  padding: 1.125rem 1.25rem;
  border-top: 1px solid var(--sidebar-border);
}

.admin-sidebar .back-link,
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #94A3B8 !important;         /* Overrides text-stone-500 for WCAG compliance */
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: color 0.15s ease;
}

.admin-sidebar .back-link:hover,
.back-link:hover {
  color: #E5383B !important;         /* Poppy Red hover */
}

/* Main Content Area */
.admin-main {
  flex: 1;
  margin-left: 250px;
  padding: 2rem 2.5rem;
  max-width: 1300px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.75rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0F172A;
  letter-spacing: -0.02em;
}

/* Stat Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--card-bg);
  padding: 1.25rem;
  border-radius: 12px;
  border: 1px solid #E2E8F0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.stat-title {
  font-size: 0.75rem;
  color: #64748B;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

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

/* Content Cards & Tables */
.card {
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid #E2E8F0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0F172A;
}

.table-responsive {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748B;
  background-color: #F3EDE2;
  border-bottom: 1px solid #E2E8F0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #F1F5F9;
  font-size: 0.875rem;
  color: #334155;
}

tr:hover td {
  background-color: #F3EDE2;
}

[data-theme="dark"] tr:hover td, [data-theme="slate"] tr:hover td, html.dark tr:hover td {
  background-color: rgba(51, 65, 85, 0.4) !important;
}


/* Badges */
.badge {
  padding: 0.35rem 0.75rem !important;
  border-radius: 9999px !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
  height: auto !important;
  min-height: 1.625rem !important;
  white-space: nowrap !important;
  line-height: 1.25 !important;
  box-sizing: border-box !important;
}

.badge-active { background: #ECFDF5 !important; color: #047857 !important; border: 1px solid #A7F3D0 !important; }
.badge-closed { background: #FEF2F2 !important; color: #B91C1C !important; border: 1px solid #FECACA !important; }
.badge-gold { background: #FFFBEB !important; color: #92400E !important; border: 1px solid #FCD34D !important; }
.badge-ghost { background: #F3EDE2 !important; color: #44403C !important; border: 1px solid #D6CEC2 !important; }

/* Dark mode badge overrides — ensure legible contrast on slate backgrounds */
[data-theme="dark"] .badge-active, [data-theme="slate"] .badge-active, html.dark .badge-active {
  background: rgba(4, 120, 87, 0.18) !important;
  color: #34D399 !important;
  border: 1px solid rgba(52, 211, 153, 0.35) !important;
}
[data-theme="dark"] .badge-closed, [data-theme="slate"] .badge-closed, html.dark .badge-closed {
  background: rgba(185, 28, 28, 0.18) !important;
  color: #FCA5A5 !important;
  border: 1px solid rgba(252, 165, 165, 0.35) !important;
}
[data-theme="dark"] .badge-gold, [data-theme="slate"] .badge-gold, html.dark .badge-gold {
  background: rgba(180, 83, 9, 0.22) !important;
  color: #FCD34D !important;
  border: 1px solid rgba(252, 211, 77, 0.35) !important;
}
[data-theme="dark"] .badge-ghost, [data-theme="slate"] .badge-ghost, html.dark .badge-ghost {
  background: rgba(100, 116, 139, 0.20) !important;
  color: #CBD5E1 !important;
  border: 1px solid rgba(100, 116, 139, 0.40) !important;
}

/* Buttons */
.btn {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  font-size: 0.8125rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary-red);
  color: #FAF7F2;
}

.btn-primary:hover {
  background-color: var(--primary-red-dark);
}

.btn-outline {
  background-color: transparent;
  border: 1px solid #CBD5E1;
  color: #334155;
}

.btn-outline:hover {
  border-color: #94A3B8;
  background-color: #F3EDE2;
}

.btn-danger {
  background-color: #DC2626;
  color: #FAF7F2;
}

.btn-danger:hover {
  background-color: #B91C1C;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
  font-size: 0.8125rem;
  color: #334155;
}

.form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.875rem;
  color: #0F172A;
  background-color: #FAF7F2;
  box-sizing: border-box;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-red);
  box-shadow: 0 0 0 3px rgba(229, 56, 59, 0.12);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-card {
  background: #FAF7F2;
  width: 100%;
  max-width: 480px;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  transform: scale(0.98);
  transition: transform 0.2s ease;
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: #94A3B8;
}

.modal-close:hover {
  color: #0F172A;
}

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: #FAF7F2;
  padding: 0.875rem 1.25rem;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  border-left: 4px solid var(--primary-red);
  font-size: 0.875rem;
}

/* Mobile Admin Navbar & Drawer */
.mobile-admin-bar {
  display: none;
  background: var(--sidebar-bg);
  padding: 0.75rem 1rem;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  position: sticky;
  top: 0;
  z-index: 90;
}

@media (max-width: 768px) {
  body {
    flex-direction: column;
  }
  .mobile-admin-bar {
    display: flex;
  }
  .admin-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    top: 0;
    bottom: 0;
    box-shadow: 0 0 30px rgba(0,0,0,0.3);
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }
  .admin-main {
    margin-left: 0;
    padding: 1.25rem 1rem;
  }
  .admin-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 95;
  }
  .admin-backdrop.active {
    display: block;
  }
}

/* Accessibility: Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Admin Theme Toggle Button Styling
   ========================================================================== */
.theme-toggle {
  cursor: pointer;
  background: transparent;
  border: none;
  outline: none;
  line-height: 1;
  user-select: none;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease, background-color 0.2s ease;
}

.theme-toggle:hover {
  transform: scale(1.08);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.theme-icon-sun, .theme-icon-moon {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

/* ==========================================================================
   Modern Slate Admin Dark Mode Component Overrides
   ========================================================================== */
[data-theme="dark"] body, [data-theme="slate"] body, html.dark body {
  background-color: #0F172A !important;
  color: #F8FAFC !important;
}

[data-theme="dark"] .admin-sidebar, [data-theme="slate"] .admin-sidebar, html.dark .admin-sidebar {
  background-color: #0F172A;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .stat-card, [data-theme="slate"] .stat-card, html.dark .stat-card,
[data-theme="dark"] .card, [data-theme="slate"] .card, html.dark .card {
  background: #1E293B;
  border-color: #334155;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .stat-value, [data-theme="slate"] .stat-value, html.dark .stat-value,
[data-theme="dark"] .card-title, [data-theme="slate"] .card-title, html.dark .card-title,
[data-theme="dark"] .page-title, [data-theme="slate"] .page-title, html.dark .page-title {
  color: #F8FAFC !important;
}

[data-theme="dark"] th, [data-theme="slate"] th, html.dark th {
  background-color: #162032;
  color: #94A3B8;
  border-color: #334155;
}

[data-theme="dark"] td, [data-theme="slate"] td, html.dark td {
  border-color: #334155;
  color: #E2E8F0;
}

[data-theme="dark"] tr:hover td, [data-theme="slate"] tr:hover td, html.dark tr:hover td {
  background-color: #263349;
}

[data-theme="dark"] .form-control, [data-theme="slate"] .form-control, html.dark .form-control {
  background-color: #0F172A;
  border-color: #475569;
  color: #F8FAFC;
}

[data-theme="dark"] .form-label, [data-theme="slate"] .form-label, html.dark .form-label {
  color: #CBD5E1;
}

[data-theme="dark"] .btn-outline, [data-theme="slate"] .btn-outline, html.dark .btn-outline {
  border-color: #475569;
  color: #E2E8F0;
}

[data-theme="dark"] .btn-outline:hover, [data-theme="slate"] .btn-outline:hover, html.dark .btn-outline:hover {
  background-color: #334155;
  border-color: #64748B;
  color: #F8FAFC;
}

[data-theme="dark"] .modal-card, [data-theme="slate"] .modal-card, html.dark .modal-card {
  background: #1E293B;
  border: 1px solid #334155;
  color: #F8FAFC;
}

[data-theme="dark"] .toast, [data-theme="slate"] .toast, html.dark .toast {
  background: #1E293B !important;
  color: #F8FAFC !important;
  border-left-color: var(--primary-red);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .mobile-admin-bar, [data-theme="slate"] .mobile-admin-bar, html.dark .mobile-admin-bar {
  background: #0B0F19;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Admin Modern Slate Text & Surface Overrides */
[data-theme="dark"] .text-stone-900, [data-theme="slate"] .text-stone-900, html.dark .text-stone-900,
[data-theme="dark"] .text-stone-800, [data-theme="slate"] .text-stone-800, html.dark .text-stone-800 {
  color: #F8FAFC !important;
}

[data-theme="dark"] .text-stone-700, [data-theme="slate"] .text-stone-700, html.dark .text-stone-700,
[data-theme="dark"] .text-stone-600, [data-theme="slate"] .text-stone-600, html.dark .text-stone-600 {
  color: #CBD5E1 !important;
}

[data-theme="dark"] .text-stone-500, [data-theme="slate"] .text-stone-500, html.dark .text-stone-500,
[data-theme="dark"] .text-stone-400, [data-theme="slate"] .text-stone-400, html.dark .text-stone-400 {
  color: #94A3B8 !important;
}

[data-theme="dark"] .bg-\[\#FAF7F2\], [data-theme="slate"] .bg-\[\#FAF7F2\], html.dark .bg-\[\#FAF7F2\],
[data-theme="dark"] select.bg-\[\#FAF7F2\], [data-theme="slate"] select.bg-\[\#FAF7F2\], html.dark select.bg-\[\#FAF7F2\],
[data-theme="dark"] select, [data-theme="slate"] select, html.dark select,
[data-theme="dark"] .bg-stone-50, [data-theme="slate"] .bg-stone-50, html.dark .bg-stone-50,
[data-theme="dark"] .bg-stone-100, [data-theme="slate"] .bg-stone-100, html.dark .bg-stone-100 {
  background-color: #1E293B !important;
  color: #F8FAFC !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .border-stone-100, [data-theme="slate"] .border-stone-100, html.dark .border-stone-100,
[data-theme="dark"] .border-stone-200, [data-theme="slate"] .border-stone-200, html.dark .border-stone-200 {
  border-color: #334155 !important;
}

[data-theme="dark"] .divide-stone-100 > :not([hidden]) ~ :not([hidden]),
[data-theme="slate"] .divide-stone-100 > :not([hidden]) ~ :not([hidden]),
html.dark .divide-stone-100 > :not([hidden]) ~ :not([hidden]) {
  border-color: #334155 !important;
}

/* ==========================================================================
   Global Imagery Dimming Filter in Admin Dark Mode
   Softens bright image/avatar assets in Modern Slate dark mode
   while preserving the default warm cream light mode.
   ========================================================================== */
[data-theme="dark"] img,
[data-theme="slate"] img,
html.dark img {
  filter: brightness(0.82) contrast(1.04);
  transition: filter 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] img:hover,
[data-theme="slate"] img:hover,
html.dark img:hover {
  filter: brightness(1) contrast(1);
}

[data-theme="dark"] .sidebar-logo,
[data-theme="slate"] .sidebar-logo,
html.dark .sidebar-logo {
  filter: brightness(0.92);
}


