/* ==========================================
   VEZIR KONTROL - EMERALD LIGHT THEME
   Light-mode Emerald CMS color overrides for Flux components
   ========================================== */

:root {
  /* ============================================
     EMERALD BRAND COLORS (LIGHT MODE)
     ============================================ */
  --vf-primary: #059669;           /* Emerald 600 - Primary actions */
  --vf-secondary: #10B981;         /* Emerald 500 - Secondary */
  --vf-primary-dark: #047857;      /* Emerald 700 - Hover state */
  --vf-primary-light: #34D399;     /* Emerald 400 - Light accent */
  
  /* Light Mode Surfaces */
  --vf-dark: #F9FAFB;              /* Gray 50 - Page background */
  --vf-surface: #FFFFFF;           /* White - Card surface */
  --vf-surface-variant: #F3F4F6;   /* Gray 100 - Alternate surface */
  --vf-input-bg: #FFFFFF;          /* White - Input background */
  
  /* Text Colors */
  --vf-text-primary: #111827;      /* Gray 900 - Primary text */
  --vf-text-secondary: #6B7280;    /* Gray 500 - Secondary text */
  --vf-text-muted: #9CA3AF;        /* Gray 400 - Muted text */
  
  /* Emerald-specific styles */
  --vf-flux-gradient: linear-gradient(135deg, #059669 0%, #10B981 100%);
  --vf-sidebar-gradient: linear-gradient(180deg, #064E3B 0%, #065F46 100%);
  --vf-glow-emerald: 0 0 0 3px rgba(16, 185, 129, 0.2);
  --vf-glow-cyan: var(--vf-glow-emerald);
  
  /* Card and border */
  --vf-card-border: rgba(0, 0, 0, 0.08);
  --vf-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  
  /* Update Flux variables to Emerald */
  --flux-primary: var(--vf-primary);
  --flux-primary-hover: var(--vf-primary-dark);
  --flux-primary-light: #D1FAE5;   /* Emerald 100 */
  --flux-secondary: var(--vf-secondary);
  --flux-table-row-selected-bg: var(--flux-primary-light);
  --flux-table-row-selected-hover-bg: #A7F3D0; /* Emerald 200 */
  
  /* Semantic colors */
  --flux-success: #10B981;
  --flux-success-hover: #059669;
  --flux-success-light: #D1FAE5;
  
  --flux-danger: #EF4444;
  --flux-danger-hover: #DC2626;
  --flux-danger-light: #FEE2E2;
  
  --flux-warning: #F59E0B;
  --flux-warning-hover: #D97706;
  --flux-warning-light: #FEF3C7;
  
  --flux-info: #3B82F6;
  --flux-info-hover: #2563EB;
  --flux-info-light: #DBEAFE;
  
  /* Text */
  --flux-text-primary: var(--vf-text-primary);
  --flux-text-secondary: var(--vf-text-secondary);
  --flux-text-muted: var(--vf-text-muted);

  /* Backgrounds */
  --flux-bg-primary: #FFFFFF;
  --flux-bg-secondary: #F9FAFB;
  --flux-bg-tertiary: #F3F4F6;
  --flux-bg-hover: #F3F4F6;
  
  /* Borders */
  --flux-border: #E5E7EB;
  --flux-border-hover: #D1D5DB;
  --flux-border-focus: var(--vf-primary);
  
  /* Focus shadows - Emerald */
  --flux-shadow-focus: 0 0 0 3px rgba(5, 150, 105, 0.2);
  
  /* ============================================
     SPACING SYSTEM (8px base)
     ============================================ */
  --space-0: 0;
  --space-1: 0.25rem;    /* 4px */
  --space-2: 0.5rem;     /* 8px */
  --space-3: 0.75rem;    /* 12px */
  --space-4: 1rem;       /* 16px */
  --space-5: 1.25rem;    /* 20px */
  --space-6: 1.5rem;     /* 24px */
  --space-7: 1.75rem;    /* 28px */
  --space-8: 2rem;       /* 32px */
  --space-10: 2.5rem;    /* 40px */
  --space-12: 3rem;      /* 48px */
  --space-16: 4rem;      /* 64px */
  --space-20: 5rem;      /* 80px */
  
  /* ============================================
     SIZING SYSTEM
     ============================================ */
  /* Icon sizes */
  --size-icon-xs: 12px;
  --size-icon-sm: 16px;
  --size-icon-md: 20px;
  --size-icon-lg: 24px;
  --size-icon-xl: 32px;
  --size-icon-2xl: 48px;
  
  /* Avatar sizes */
  --size-avatar-sm: 32px;
  --size-avatar-md: 40px;
  --size-avatar-lg: 56px;
  --size-avatar-xl: 80px;
  
  /* Border radius */
  --radius-sm: 0.25rem;    /* 4px */
  --radius-md: 0.375rem;   /* 6px */
  --radius-lg: 0.5rem;     /* 8px */
  --radius-xl: 0.75rem;    /* 12px */
  --radius-2xl: 1rem;      /* 16px */
  --radius-full: 9999px;
  
  /* ============================================
     TYPOGRAPHY SCALE
     ============================================ */
  --font-size-xs: 0.75rem;      /* 12px */
  --font-size-sm: 0.875rem;     /* 14px */
  --font-size-base: 1rem;       /* 16px */
  --font-size-lg: 1.125rem;     /* 18px */
  --font-size-xl: 1.25rem;      /* 20px */
  --font-size-2xl: 1.5rem;      /* 24px */
  --font-size-3xl: 1.875rem;    /* 30px */
  --font-size-4xl: 2.25rem;     /* 36px */
  
  /* Font weights */
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  /* Line heights */
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;
  
  /* ============================================
     Z-INDEX SCALE
     ============================================ */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */
/* Auto dark mode (OS preference) */
@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    /* Dark Mode Colors */
    --vf-dark: #0F172A;              /* Slate 900 - Dark background */
    --vf-surface: #1E293B;           /* Slate 800 - Card surface */
    --vf-surface-variant: #334155;   /* Slate 700 - Alternate surface */
    --vf-input-bg: #1E293B;          /* Slate 800 - Input background */
    
    /* Dark Mode Text */
    --vf-text-primary: #F8FAFC;      /* Slate 50 - Primary text */
    --vf-text-secondary: #94A3B8;    /* Slate 400 - Secondary text */
    --vf-text-muted: #64748B;        /* Slate 500 - Muted text */
    
    /* Flux Dark Overrides */
    --flux-bg-primary: #1E293B;
    --flux-bg-secondary: #0F172A;
    --flux-bg-tertiary: #334155;
    --flux-bg-hover: #334155;
    
    --flux-text-primary: var(--vf-text-primary);
    --flux-text-secondary: var(--vf-text-secondary);
    --flux-text-muted: var(--vf-text-muted);
    
    --flux-border: #334155;
    --flux-border-hover: #475569;
  }
  
  body {
    background-color: #0F172A !important;
    color: #F8FAFC !important;
  }
}

/* Manual dark mode (via .dark class) */
:root.dark {
  /* Dark Mode Colors */
  --vf-dark: #0F172A;
  --vf-surface: #1E293B;
  --vf-surface-variant: #334155;
  --vf-input-bg: #1E293B;
  
  /* Dark Mode Text */
  --vf-text-primary: #F8FAFC;
  --vf-text-secondary: #94A3B8;
  --vf-text-muted: #64748B;
  
  /* Flux Dark Overrides */
  --flux-bg-primary: #1E293B;
  --flux-bg-secondary: #0F172A;
  --flux-bg-tertiary: #334155;
  --flux-bg-hover: #334155;
  
  --flux-text-primary: var(--vf-text-primary);
  --flux-text-secondary: var(--vf-text-secondary);
  --flux-text-muted: var(--vf-text-muted);
  
  --flux-border: #334155;
  --flux-border-hover: #475569;
}

:root.dark body,
@media (prefers-color-scheme: dark) {
  :root:not(.light) body {
    background-color: #0F172A !important;
    color: #F8FAFC !important;
  }
}

/* Dark mode styles for both auto and manual */
:root.dark .flux-input,
:root.dark .flux-select,
:root.dark .flux-textarea,
:root.dark input,
:root.dark textarea,
:root.dark select,
@media (prefers-color-scheme: dark) {
  :root:not(.light) .flux-input,
  :root:not(.light) .flux-select,
  :root:not(.light) .flux-textarea,
  :root:not(.light) input,
  :root:not(.light) textarea,
  :root:not(.light) select {
    background-color: #1E293B !important;
    border-color: #334155 !important;
    color: #F8FAFC !important;
  }
}

:root.dark .stat-card,
:root.dark .emerald-card,
:root.dark .modal-content,
@media (prefers-color-scheme: dark) {
  :root:not(.light) .stat-card,
  :root:not(.light) .emerald-card,
  :root:not(.light) .modal-content {
    background: #1E293B;
    border-color: #334155;
  }
}

:root.dark .text-muted,
@media (prefers-color-scheme: dark) {
  :root:not(.light) .text-muted {
    color: #94A3B8;
  }
}

:root.dark .page-header h2,
@media (prefers-color-scheme: dark) {
  :root:not(.light) .page-header h2 {
    color: #F8FAFC;
  }
}

:root.dark .page-header p,
@media (prefers-color-scheme: dark) {
  :root:not(.light) .page-header p {
    color: #94A3B8;
  }
}

/* ============================================
   BODY & BASE STYLES (LIGHT)
   ============================================ */
body {
  background-color: #F9FAFB !important;
  color: #111827 !important;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ============================================
   BUTTON OVERRIDES - EMERALD
   ============================================ */
   
/* Primary buttons - Emerald green */
.material-button--contained.material-button--primary,
.flux-button--primary {
  background: linear-gradient(135deg, #059669 0%, #10B981 100%) !important;
  border-color: #059669 !important;
  color: #FFFFFF !important;
}

.material-button--contained.material-button--primary:hover,
.flux-button--primary:hover {
  background: linear-gradient(135deg, #047857 0%, #059669 100%) !important;
  border-color: #047857 !important;
}

/* Outlined buttons */
.material-button--outlined.material-button--primary,
.flux-button--outlined {
  background: transparent !important;
  border: 1px solid #059669 !important;
  color: #059669 !important;
}

.material-button--outlined.material-button--primary:hover,
.flux-button--outlined:hover {
  background: rgba(5, 150, 105, 0.1) !important;
}

/* Secondary/Default buttons - Light gray */
.material-button--outlined.material-button--secondary,
.flux-button--secondary {
  background: #FFFFFF !important;
  border: 1px solid #D1D5DB !important;
  color: #374151 !important;
}

.material-button--outlined.material-button--secondary:hover,
.flux-button--secondary:hover {
  background: #F3F4F6 !important;
  border-color: #9CA3AF !important;
}

/* ============================================
   INPUT OVERRIDES - LIGHT
   ============================================ */

/* All inputs - Light background - COMPREHENSIVE */
.flux-input,
.flux-select,
.flux-textarea,
.flux-search-input-field,
.material-input input,
.material-input .flux-input,
.material-select select,
.material-textarea textarea,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="url"],
input[type="tel"],
input[type="search"],
textarea,
select {
  background-color: #FFFFFF !important;
  border: 1px solid #D1D5DB !important;
  border-radius: 0.5rem !important;
  color: #111827 !important;
}

.flux-input:focus,
.flux-select:focus,
.flux-textarea:focus,
.flux-search-input-field:focus,
.material-input input:focus,
input:focus,
textarea:focus,
select:focus {
  border-color: #059669 !important;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1) !important;
  outline: none !important;
}

.flux-input::placeholder,
.flux-search-input-field::placeholder,
input::placeholder,
textarea::placeholder {
  color: #9CA3AF !important;
}

/* Select wrapper */
.flux-select-wrapper {
  background: transparent !important;
}

/* Search input wrapper */
.flux-search-input {
  background: transparent !important;
}

.flux-search-input-icon {
  color: #9CA3AF !important;
}

/* ============================================
   CARD OVERRIDES - LIGHT
   ============================================ */
.material-card,
.flux-card {
  background: #FFFFFF !important;
  border: 1px solid #E5E7EB !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

/* ============================================
   TABLE OVERRIDES - LIGHT
   ============================================ */
.flux-table-wrapper,
.material-table-wrapper {
  background: #FFFFFF !important;
}

.flux-table-th {
  background: #F9FAFB !important;
  color: #6B7280 !important;
  border-bottom-color: #E5E7EB !important;
}

.flux-table-td {
  color: #374151 !important;
  border-bottom-color: #F3F4F6 !important;
}

.flux-table--hoverable .flux-table-row:hover {
  background: #F0FDF4 !important;  /* Emerald 50 */
}

.flux-table--striped .flux-table-row:nth-child(even) {
  background: #F9FAFB !important;
}

/* Striped + Hover: hover must win over stripe on even rows */
.flux-table--hoverable.flux-table--striped .flux-table-row:nth-child(even):hover {
  background: #F0FDF4 !important;  /* Emerald 50 */
}

/* Selected row */
.flux-table-row--selected,
.flux-table--striped .flux-table-row--selected:nth-child(even) {
  background: var(--flux-table-row-selected-bg, #D1FAE5) !important;
}

/* Hover on selected rows */
.flux-table--hoverable .flux-table-row--selected:hover,
.flux-table--hoverable.flux-table--striped .flux-table-row--selected:nth-child(even):hover {
  background: var(--flux-table-row-selected-hover-bg, #A7F3D0) !important;
}

/* ============================================
   BADGE OVERRIDES
   ============================================ */
.flux-badge--primary,
.material-badge--primary {
  background: #D1FAE5 !important;
  color: #065F46 !important;
}

/* ============================================
   ALERT OVERRIDES
   ============================================ */
.flux-alert,
.material-alert {
  background: #FFFFFF !important;
  border: 1px solid #E5E7EB !important;
}

/* ============================================
   KONTROL-SPECIFIC UTILITIES
   ============================================ */

/* Emerald accent class for highlights */
.emerald-accent {
  color: var(--vf-secondary);
}

.emerald-bg {
  background: var(--vf-primary);
}

/* Page container */
.kontrol-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0;
}

/* Emerald-themed cards (keep for special use) */
.emerald-card {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 0.5rem;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.emerald-card:hover {
  border-color: var(--vf-secondary);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
  transform: translateY(-2px);
}

/* ============================================
   SCROLLBAR (Emerald Theme - Light)
   ============================================ */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #F3F4F6;
}

::-webkit-scrollbar-thumb {
  background: #D1D5DB;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #059669;
}

/* ============================================
   SELECTION (Emerald Theme)
   ============================================ */
::selection {
  background: #A7F3D0;
  color: #065F46;
}

::-moz-selection {
  background: #A7F3D0;
  color: #065F46;
}

/* ============================================
   MODAL & FORM STYLES
   ============================================ */

/* Modal content - ensure light background */
.flux-modal-content,
.modal-form {
  background: #FFFFFF !important;
  color: #111827 !important;
}

/* Form Tabs - Emerald Style */
.form-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #E5E7EB;
}

.form-tab {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6B7280;
  background: transparent;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.form-tab:hover {
  color: #059669;
  background: #F0FDF4;
}

.form-tab.active {
  color: #FFFFFF;
  background: linear-gradient(135deg, #059669 0%, #10B981 100%);
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.3);
}

/* Form Groups */
.form-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

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

.form-label.required::after {
  content: " *";
  color: #EF4444;
}

/* Modal Footer */
.flux-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 1.5rem;
  margin-top: 1.5rem;
  border-top: 1px solid #E5E7EB;
}

/* ============================================
   GLOBAL MODAL STYLES
   ============================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #FFFFFF;
  border-radius: 0.75rem;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

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

.modal-header h3 {
  margin: 0;
  color: #111827;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #6B7280;
  padding: 0.25rem;
  border-radius: 0.25rem;
  transition: all 0.15s;
}

.modal-close:hover {
  background: #F3F4F6;
  color: #111827;
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid #E5E7EB;
  background: #F9FAFB;
}

.modal-form {
  padding: 0;
}

/* ============================================
   GLOBAL UTILITY CLASSES
   ============================================ */
.loading-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  gap: 1rem;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  color: #6B7280;
}

.empty-state h3,
.empty-state h4 {
  margin: 1rem 0 0.5rem 0;
  color: #111827;
}

.text-muted {
  color: #6B7280;
}

.text-danger {
  color: #EF4444;
}

.font-semibold {
  font-weight: 600;
}

.btn-group {
  display: flex;
  gap: 0.5rem;
}

/* Form section title */
.form-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  margin: 0 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #E5E7EB;
}

/* Checkbox group */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.checkbox-group input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: #059669;
  cursor: pointer;
}

.checkbox-group label {
  font-size: 0.875rem;
  color: #374151;
  cursor: pointer;
  user-select: none;
}

/* Page structure */
.page-container {
  /* No max-width — fills kontrol-content; FillPage tables go edge-to-edge */
}

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

.page-header h2 {
  margin: 0;
  font-size: 1.875rem;
  font-weight: 700;
  color: #111827;
}

.page-header p {
  margin: 0.25rem 0 0 0;
  color: #6B7280;
  font-size: 0.875rem;
}

/* Dashboard Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: #FFFFFF;
  padding: 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid #E5E7EB;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stat-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: #111827;
}
