/* ==========================================================================
   ZEO INFINITY PLATFORM - ADMIN ANALYTICS & MANAGEMENT DASHBOARD STYLES
   Light Mode + Dark Mode & Mobile/Tablet Responsive Design System
   ========================================================================== */

:root {
  --admin-bg-dark: #090D16;
  --admin-sidebar-dark: #0D1322;
  --admin-card-dark: #111A2E;
  --admin-text-dark: #E2E8F0;
  --admin-text-muted-dark: #94A3B8;
  --admin-border-dark: rgba(255, 255, 255, 0.08);

  --admin-bg-light: #F8FAFC;
  --admin-sidebar-light: #FFFFFF;
  --admin-card-light: #FFFFFF;
  --admin-text-light: #0F172A;
  --admin-text-muted-light: #64748B;
  --admin-border-light: #E2E8F0;

  --admin-primary: #0067E8;
  --admin-primary-hover: #0052BC;
}

/* Base Wrapper */
.zi-admin-wrapper {
  display: flex;
  min-height: 100vh;
  background: var(--admin-bg-dark);
  color: var(--admin-text-dark);
  font-family: 'Inter', sans-serif;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ==========================================================================
   Light Mode System Overrides
   ========================================================================== */
body.light-mode {
  background: var(--admin-bg-light) !important;
  color: var(--admin-text-light) !important;
}

body.light-mode .zi-admin-wrapper {
  background: var(--admin-bg-light);
  color: var(--admin-text-light);
}

body.light-mode .zi-admin-sidebar {
  background: var(--admin-sidebar-light);
  border-right-color: var(--admin-border-light);
}

body.light-mode .zi-admin-brand {
  border-bottom-color: var(--admin-border-light);
}

body.light-mode .zi-admin-nav-item {
  color: #475569;
}

body.light-mode .zi-admin-nav-item:hover,
body.light-mode .zi-admin-nav-item.active {
  background: rgba(0, 103, 232, 0.08);
  color: #0067E8;
  border-left-color: #0067E8;
}

body.light-mode .zi-admin-header {
  background: #FFFFFF;
  border-bottom-color: var(--admin-border-light);
}

body.light-mode .zi-admin-header h2 {
  color: #0F172A !important;
}

body.light-mode .zi-stat-card,
body.light-mode .zi-admin-table-box,
body.light-mode .kpi-card,
body.light-mode .chart-box {
  background: #FFFFFF !important;
  border-color: var(--admin-border-light) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

body.light-mode .zi-stat-value,
body.light-mode .kpi-val {
  color: #0F172A !important;
}

body.light-mode .zi-stat-label,
body.light-mode .kpi-label {
  color: #64748B !important;
}

body.light-mode .zi-admin-table th {
  border-bottom-color: var(--admin-border-light);
  color: #64748B;
  background: #F8FAFC;
}

body.light-mode .zi-admin-table td {
  border-bottom-color: var(--admin-border-light);
  color: #1E293B;
}

body.light-mode .zi-admin-input {
  background: #F1F5F9 !important;
  border-color: #CBD5E1 !important;
  color: #0F172A !important;
}

body.light-mode .zi-admin-input:focus {
  border-color: #0067E8 !important;
  background: #FFFFFF !important;
}

body.light-mode .modal-content-dark {
  background: #FFFFFF !important;
  color: #0F172A !important;
  border-color: var(--admin-border-light) !important;
  box-shadow: 0 20px 50px rgba(0,0,0,0.15);
}

body.light-mode .modal-title-clean {
  color: #0F172A !important;
}

body.light-mode .modal-header-clean {
  border-bottom-color: var(--admin-border-light);
}

body.light-mode .btn-modal-cancel {
  background: #F1F5F9;
  border-color: #CBD5E1;
  color: #475569;
}

body.light-mode .btn-modal-cancel:hover {
  background: #E2E8F0;
  color: #0F172A;
}

body.light-mode .zi-tbl-btn-reset {
  background: #F1F5F9;
  border-color: #CBD5E1;
  color: #1E293B;
}

body.light-mode .zi-tbl-btn-reset:hover {
  background: rgba(0, 103, 232, 0.1);
  color: #0067E8;
  border-color: #0067E8;
}

/* Chrome / Safari Autofill Overrides for Light Mode */
body.light-mode input:-webkit-autofill,
body.light-mode input:-webkit-autofill:hover, 
body.light-mode input:-webkit-autofill:focus {
  -webkit-text-fill-color: #0F172A !important;
  -webkit-box-shadow: 0 0 0px 1000px #F1F5F9 inset !important;
}

/* ==========================================================================
   Admin Sidebar & Main Section Layout
   ========================================================================== */
.zi-admin-sidebar {
  width: 260px;
  background: #0D1322;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.zi-admin-brand img {
  height: 32px;
}

.zi-admin-nav {
  padding: 1rem 0;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.zi-admin-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  color: #94A3B8;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.zi-admin-nav-item:hover,
.zi-admin-nav-item.active {
  background: rgba(0, 103, 232, 0.12);
  color: #60A5FA;
  border-left-color: #0067E8;
}

/* Main Content Area */
.zi-admin-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  max-width: 100%;
}

.zi-admin-header {
  min-height: 70px;
  height: auto;
  background: #0D1322;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  max-width: 100%;
  box-sizing: border-box;
}

.zi-admin-content {
  padding: 1.75rem 2rem;
  flex-grow: 1;
  max-width: 100%;
  box-sizing: border-box;
}

/* Dashboard Cards Grid */
.zi-admin-grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.zi-stat-card {
  background: #111A2E;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 1.35rem 1.25rem;
  position: relative;
  overflow: hidden;
}

.zi-stat-value {
  font-size: 2.1rem;
  font-weight: 800;
  color: #FFFFFF;
  font-family: 'Outfit', sans-serif;
  margin: 0.4rem 0 0.2rem 0;
}

.zi-stat-label {
  font-size: 0.8rem;
  color: #94A3B8;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Admin Tables */
.zi-admin-table-box {
  background: #111A2E;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  overflow-x: auto;
  max-width: 100%;
  box-sizing: border-box;
}

.zi-admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
}

.zi-admin-table th {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #94A3B8;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.zi-admin-table td {
  padding: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #E2E8F0;
}

.zi-badge-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.zi-badge-active { background: rgba(16, 185, 129, 0.15); color: #10B981; }
.zi-badge-suspended { background: rgba(245, 158, 11, 0.15); color: #F59E0B; }
.zi-badge-blocked { background: rgba(239, 68, 68, 0.15); color: #EF4444; }

/* Theme Toggle Button */
.zi-admin-theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #60A5FA;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  transition: all 0.2s ease;
}

.zi-admin-theme-toggle:hover {
  background: rgba(0, 103, 232, 0.2);
  transform: scale(1.05);
}

body.light-mode .zi-admin-theme-toggle {
  background: #F1F5F9;
  border-color: #CBD5E1;
  color: #0F172A;
}

/* Backdrop for Mobile Sidebar */
.zi-admin-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 12, 23, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.zi-admin-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* Mobile Header Topbar */
.zi-mobile-topbar {
  display: none;
  height: 60px;
  background: #0D1322;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0 1.25rem;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 9990;
}

body.light-mode .zi-mobile-topbar {
  background: #FFFFFF;
  border-bottom-color: var(--admin-border-light);
}

.zi-admin-hamburger {
  background: transparent;
  border: none;
  color: #60A5FA;
  font-size: 1.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

body.light-mode .zi-admin-hamburger {
  color: #0F172A;
}

/* ==========================================================================
   Responsive Breakpoints for Mobile & Tablet
   ========================================================================== */
@media (max-width: 991px) {
  .zi-mobile-topbar {
    display: flex;
  }

  .zi-admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 10000;
    transform: translateX(-100%);
    box-shadow: none;
  }

  .zi-admin-sidebar.active {
    transform: translateX(0);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.6);
  }

  .zi-admin-header {
    padding: 1rem 1.25rem;
  }

  .zi-admin-content {
    padding: 1.25rem;
  }

  .kpi-grid-8 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 576px) {
  .kpi-grid-8 {
    grid-template-columns: 1fr !important;
  }

  .zi-admin-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .zi-btn-primary {
    width: 100% !important;
    justify-content: center;
  }

  .modal-content-dark {
    padding: 1.25rem;
  }
}

/* ==========================================================================
   PREMIUM DATE PICKER & PERIOD COMPARISON STYLES
   ========================================================================== */
.zi-btn-date-trigger {
  background: #162032;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
  padding: 0.55rem 1.1rem;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.zi-btn-date-trigger:hover {
  border-color: #0067E8;
  background: #1A2740;
  box-shadow: 0 6px 18px rgba(0, 103, 232, 0.3);
}

body.light-mode .zi-btn-date-trigger {
  background: #FFFFFF;
  border-color: #CBD5E1;
  color: #0F172A;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

body.light-mode .zi-btn-date-trigger:hover {
  border-color: #0067E8;
  background: #F8FAFC;
}

.zi-badge-compare-active {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #FBBF24;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Global Admin Modal Backdrop Overlay */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(7, 12, 23, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow-y: auto;
  box-sizing: border-box;
}

@keyframes modalPop {
  0% { transform: scale(0.94); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Date Comparison Modal Card */
.zi-date-compare-card {
  background: #0F172A;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  width: 100%;
  max-width: 620px;
  padding: 1.75rem;
  color: #FFFFFF;
  box-shadow: 0 30px 60px rgba(0,0,0,0.7);
  font-family: 'Inter', sans-serif;
  animation: modalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  box-sizing: border-box;
}

body.light-mode .zi-date-compare-card {
  background: #FFFFFF;
  border-color: #E2E8F0;
  color: #0F172A;
  box-shadow: 0 20px 50px rgba(0,0,0,0.15);
}

.modal-header-clean {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

body.light-mode .modal-header-clean {
  border-bottom-color: #E2E8F0;
}

.modal-title-clean {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0;
  display: flex;
  align-items: center;
  font-family: 'Outfit', sans-serif;
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94A3B8;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
}

.modal-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #EF4444;
  color: #EF4444;
}

body.light-mode .modal-close-btn {
  background: #F1F5F9;
  border-color: #CBD5E1;
  color: #475569;
}

.modal-actions-clean {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

body.light-mode .modal-actions-clean {
  border-top-color: #E2E8F0;
}

.btn-modal-cancel {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94A3B8;
  padding: 0.6rem 1.2rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-modal-cancel:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
}

body.light-mode .btn-modal-cancel {
  background: #F1F5F9;
  border-color: #CBD5E1;
  color: #475569;
}

.btn-modal-submit {
  background: linear-gradient(135deg, #0067E8 0%, #0052B8 100%);
  border: none;
  color: #FFFFFF;
  padding: 0.6rem 1.4rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 103, 232, 0.35);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
}

.btn-modal-submit:hover {
  background: linear-gradient(135deg, #1A78F2 0%, #0067E8 100%);
  box-shadow: 0 6px 20px rgba(0, 103, 232, 0.5);
  transform: translateY(-1px);
}

.zi-preset-chip {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #CBD5E1;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-block;
  text-decoration: none;
}

.zi-preset-chip:hover,
.zi-preset-chip.active {
  background: rgba(0, 103, 232, 0.2);
  border-color: #0067E8;
  color: #60A5FA;
}

body.light-mode .zi-preset-chip {
  background: #F1F5F9;
  border-color: #CBD5E1;
  color: #475569;
}

body.light-mode .zi-preset-chip:hover,
body.light-mode .zi-preset-chip.active {
  background: rgba(0, 103, 232, 0.1);
  border-color: #0067E8;
  color: #0067E8;
}

.zi-comp-summary-bar {
  background: linear-gradient(135deg, rgba(0, 103, 232, 0.12) 0%, rgba(13, 19, 34, 0.8) 100%);
  border: 1px solid rgba(0, 103, 232, 0.3);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

body.light-mode .zi-comp-summary-bar {
  background: linear-gradient(135deg, rgba(0, 103, 232, 0.06) 0%, #FFFFFF 100%);
  border-color: rgba(0, 103, 232, 0.25);
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}
