/* ==========================================================================
   Super Admin & Store Admin Dashboard Styles
   ========================================================================== */

/* Dashboard Grid Layouts */
.dash-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}
.dash-stat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.2s;
}
.dash-stat-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}
.dash-stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.dash-stat-label {
  color: rgba(255, 255, 255, 0.4);
  font-size: 12px;
  margin: 0 0 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.dash-stat-value {
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 2px 0;
}
.dash-stat-sub {
  color: rgba(255, 255, 255, 0.3);
  font-size: 12px;
}

/* Premium Card Enhancements */
.dash-stat-card.premium {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.dash-stat-card.premium::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(600px circle at var(--mouse-x) var(--mouse-y), rgba(255,255,255,0.06), transparent 40%);
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s;
}

.dash-stat-card.premium:hover::after {
  opacity: 1;
}

.dash-stat-card.premium:hover {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.03) 100%);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.dash-stat-card.premium .dash-stat-info {
  z-index: 2;
  position: relative;
}

.dash-stat-card.premium .dash-stat-icon {
  z-index: 2;
  position: relative;
  box-shadow: inset 0 0 15px rgba(255, 255, 255, 0.05);
}

/* Dashboard Breakdowns */
.dash-breakdown-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.dash-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  overflow: hidden;
}
.dash-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: 10px;
}
.dash-card-header h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  flex: 1;
}
.dash-card-body {
  padding: 16px 20px;
}
.dash-view-all {
  background: none;
  border: none;
  color: #8b5cf6;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}
.dash-view-all:hover {
  background: rgba(139, 92, 246, 0.1);
}

.dash-breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.dash-breakdown-item:last-of-type {
  border-bottom: none;
}
.dash-breakdown-left {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}
.dash-breakdown-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dash-breakdown-value {
  font-weight: 600;
  font-size: 15px;
  color: #fff;
}
.dash-breakdown-bar {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  margin-top: 14px;
  gap: 2px;
}
.dash-breakdown-bar > div {
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* Dashboard Recent Activity */
.dash-recent-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.dash-recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: all 0.15s;
}
.dash-recent-item:hover {
  background: rgba(255, 255, 255, 0.02);
}
.dash-recent-info h4 {
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 3px 0;
  color: #fff;
}
.dash-recent-meta {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
}
.dash-recent-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dash-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.dash-recent-date {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
}
.dash-mini-badge {
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.dash-empty {
  padding: 30px;
  text-align: center;
  color: rgba(255, 255, 255, 0.25);
  font-size: 13px;
}

/* Subscription Status Badges */
.status-badge {
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  display: inline-block;
  text-align: center;
  min-width: 80px;
}
.status-badge.active {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}
.status-badge.trialing {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}
.status-badge.expired,
.status-badge.canceled {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}
.status-badge.past_due {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

/* Single View Pages (e.g. User View) */
.sv-container {
  padding: 2rem;
}
.sv-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  overflow: hidden;
}
.sv-status {
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
}
.sv-status.active {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}
.sv-status.inactive {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}
.action-toggle-btn {
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
}
.action-toggle-btn.activate {
  background: #10b981;
  color: white;
}
.action-toggle-btn.deactivate {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.2);
}
.action-toggle-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.1);
}
.action-toggle-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-text-primary {
  background: none;
  border: none;
  color: #8b5cf6;
  cursor: pointer;
  text-decoration: none;
  padding: 0;
}
.btn-text-primary:hover {
  text-decoration: underline;
}

/* Forms */
.form-input {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  outline: none;
  background-color: rgba(255, 255, 255, 0.05);
  color: white;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='rgba(255,255,255,0.5)'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
}
.form-input:focus {
  border-color: #3b82f6;
  background-color: rgba(255, 255, 255, 0.08);
}
.form-input option {
  background-color: #1a1a2e;
  color: white;
  padding: 12px;
}

/* Media Queries */
@media (max-width: 1200px) {
  .dash-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dash-breakdown-row {
    grid-template-columns: 1fr;
  }
  .dash-recent-row {
    grid-template-columns: 1fr;
  }
}
/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}
.p-25 { padding: 25px; }
.field-error {
  color: #ef4444;
  font-size: 12px;
  margin-top: 5px;
  display: block;
}
.form-input.error {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}
\n
/* SUPER ADMIN - DEEP DARK THEME */
:root {
  --admin-bg-gradient: linear-gradient(135deg, #0a0a0a 0%, #171717 100%);
  --admin-card-bg: rgba(25, 25, 25, 0.95);
  --admin-border: rgba(255, 255, 255, 0.05);
  --admin-primary: #3b82f6; /* Trust blue */
  --text-color: #f3f4f6;
  --card-bg: rgba(20, 20, 20, 0.8);
  --card-border: rgba(255, 255, 255, 0.05);
}
.admin-container { background: var(--admin-bg-gradient); color: var(--text-color); }
\n
/* ==========================================================================
   UNIFIED RESPONSIVE UTILITIES & FORM CLASSES (ADDED AUTOMATICALLY)
   ========================================================================== */
:root {
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
}

/* Base Layout */
.admin-page-container {
  padding: var(--spacing-lg);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* Responsive Grids */
.grid-responsive {
  display: grid;
  gap: var(--spacing-lg);
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .grid-responsive.cols-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-responsive.cols-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-responsive.cols-4 { grid-template-columns: repeat(4, 1fr); }
}

/* Forms */
.unified-form-group {
  margin-bottom: var(--spacing-lg);
  display: flex;
  flex-direction: column;
}
.unified-form-group label {
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 14px;
  color: var(--text-color, #fff);
}
.unified-form-row {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}
@media (min-width: 768px) {
  .unified-form-row {
    flex-direction: row;
  }
  .unified-form-row > * {
    flex: 1;
  }
}

/* Cards */
.unified-card {
  background: var(--card-bg, rgba(255,255,255,0.05));
  border: 1px solid var(--card-border, rgba(255,255,255,0.1));
  border-radius: 16px;
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.unified-card-header {
  border-bottom: 1px solid var(--card-border, rgba(255,255,255,0.1));
  padding-bottom: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.unified-card-header h2, .unified-card-header h3 {
  margin: 0;
  font-size: 1.25rem;
}

/* Actions */
.unified-actions {
  display: flex;
  gap: var(--spacing-md);
  margin-top: var(--spacing-xl);
  flex-wrap: wrap;
}
\n
/* ADDITIONAL UTILITIES */
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.p-20 { padding: 20px; }
.p-24 { padding: 24px; }
.flex-col { display: flex; flex-direction: column; }
@media (min-width: 768px) {
  .grid-col-span-2 { grid-column: span 2; }
}
\n
/* ==========================================================================
   DATATABLE RESPONSIVENESS FIX
   ========================================================================== */
.datatable-wrapper {
    width: 100%;
    max-width: 100%;
}
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}
.custom-table {
    width: 100%;
    /* Prevent table columns from being squished too much on mobile */
    min-width: 800px; 
}
\n
/* ==========================================================================
   DATATABLE TOOLBAR WRAPPING FIX
   ========================================================================== */
.datatable-toolbar {
    display: flex;
    flex-wrap: wrap !important;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
}
.toolbar-left {
    display: flex;
    flex-wrap: wrap !important;
    gap: 1rem;
    align-items: center;
    flex: 1 1 auto;
}
.filters-group {
    display: flex;
    flex-wrap: wrap !important;
    gap: 0.5rem;
}
.search-box {
    flex: 1 1 200px;
    max-width: 300px;
}
/* Ensure the page wrapper doesn't expand beyond viewport */
html, body {
    max-width: 100vw;
    overflow-x: hidden;
}
\n
/* ==========================================================================
   FLEXBOX OVERFLOW/BLOWOUT FIX (FORCE TABLE SCROLLBAR)
   ========================================================================== */
/* When a flex child has a table, it stretches. This forces it to scroll instead. */
.dashboard-layout {
    width: 100vw;
    max-width: 100vw;
    overflow-x: hidden;
}

.dashboard-main-area,
.dashboard-container,
.dashboard-main,
.admin-page-container,
.content-grid-full,
.profile-card,
.unified-card {
    min-width: 0; /* Critical for Flexbox */
    max-width: 100%;
}
\n
/* ==========================================================================
   BACKDROP FILTER CHROME BUG FIX
   ========================================================================== */
.dashboard-sidebar {
    transform: translateZ(0);
    will-change: transform;
}
.dashboard-main-area {
    isolation: isolate;
}
\n
/* ==========================================================================
   GLOBAL TYPOGRAPHY COLOR FIXES (FORCE LIGHT TEXT ON DARK BG)
   ========================================================================== */
body, 
.admin-container, 
.dashboard-container,
.dashboard-main-area,
.admin-page-container {
    color: #ffffff;
}

h1, h2, h3, h4, h5, h6, 
.h1, .h2, .h3, .h4, .h5, .h6,
label, .form-label, 
legend, 
.card-title, .section-title,
.profile-card h2, .profile-card h3, .profile-card h4,
.unified-card h2, .unified-card h3, .unified-card h4 {
    color: #ffffff !important;
}

p, span, div, 
.text-muted, 
.text-gray-500, .text-gray-600,
.form-text, .help-block,
.card-subtitle, .section-subtitle,
.profile-card p, .unified-card p {
    /* If an element has specific colors like red/green, we don't want to override those, 
       but we need a default light color for standard text */
    color: rgba(255, 255, 255, 0.85);
}

/* Specific overrides where we don't want the global p/span/div rule to ruin things */
.btn, button, .badge, .status-badge, .alert, 
.text-primary, .text-success, .text-danger, .text-warning, .text-info {
    color: inherit;
}

/* Ensure form inputs have white text */
input, textarea, select {
    color: #ffffff !important;
}
input::placeholder, textarea::placeholder {
    color: rgba(255, 255, 255, 0.4) !important;
}
.sv-actions .btn-primary {
    text-decoration: none;
}
.card-footer.fr-cr {
    padding: 0px 2rem 2rem 2rem;
}
