/*
 * MigroStack Modern Theme System
 * Supports native dark/light modes with system preference detection
 * Professional enterprise color scheme
 */

/* ==================== ROOT VARIABLES ==================== */
:root {
  /* Azure-Style Brand Colors - Dark Professional Blues */
  --primary-blue: #0078D4;         /* Azure primary blue */
  --primary-blue-light: #50E6FF;   /* Azure accent light blue */
  --primary-blue-dark: #005A9E;    /* Darker Azure blue */
  --primary-blue-darker: #004578;  /* Darkest Azure blue */
  --primary-purple: #0078D4;       /* Map purple to Azure blue */
  --primary-purple-light: #50E6FF; /* Map to Azure blue */
  --primary-purple-dark: #005A9E;  /* Map to Azure blue */
  --primary-purple-darker: #004578; /* Map to Azure blue */

  /* Accent Colors - Azure-style */
  --accent-emerald: #10893E;       /* Azure green */
  --accent-emerald-light: #5DB85C;
  --accent-emerald-dark: #0B6A0B;
  --accent-amber: #FFB900;         /* Azure amber */
  --accent-amber-light: #FFC83D;
  --accent-amber-dark: #D39300;

  /* Legacy RMON Colors (for backward compatibility) */
  --rmon-orange: #FFB900;
  --rmon-orange-light: #FFC83D;
  --rmon-orange-dark: #D39300;
  --rmon-orange-darker: #B87503;
  --rmon-green: #10893E;
  --rmon-green-light: #5DB85C;
  --rmon-green-dark: #0B6A0B;
  --rmon-green-darker: #094C09;

  /* Light Mode Colors - Azure Portal Style */
  --bg-primary: #F5F5F5;           /* Light gray for better readability */
  --bg-secondary: #ECECEC;         /* Slightly darker gray */
  --bg-tertiary: #E0E0E0;
  --bg-elevated: #FFFFFF;
  --bg-card: #FAFAFA;              /* Light gray for cards */
  --bg-input: #FFFFFF;

  --text-primary: #323130;
  --text-secondary: #605E5C;
  --text-tertiary: #8A8886;
  --text-inverse: #FFFFFF;

  --border-color: #EDEBE9;
  --border-color-light: #F3F2F1;
  --border-color-dark: #D2D0CE;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  --overlay-bg: rgba(0, 0, 0, 0.5);

  /* Component Colors */
  --input-bg: #FFFFFF;
  --input-border: #D1D5DB;
  --input-focus: #0078D4;
  --input-placeholder: #9CA3AF;

  --button-primary: #4B5563;
  --button-primary-hover: #374151;
  --button-secondary: #10893E;
  --button-secondary-hover: #0B6A0B;

  --success: #10893E;
  --warning: #FFB900;
  --error: #D13438;
  --info: #0078D4;

  /* Spacing Scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
}

/* ==================== DARK MODE ==================== */
/* Match Public Site Dark Theme */
[data-theme="dark"] {
  --bg-primary: #0A0E27;        /* Match public site dark background */
  --bg-secondary: #0A0E27;      /* Same as primary */
  --bg-tertiary: #1A1F3A;       /* Secondary dark */
  --bg-elevated: rgba(26, 31, 58, 0.6);  /* Cards/elevated surfaces */
  --bg-card: rgba(26, 31, 58, 0.6);
  --bg-input: rgba(10, 14, 39, 0.6);

  --text-primary: #FFFFFF;      /* White text */
  --text-secondary: #A0AEC0;    /* Match public site */
  --text-tertiary: #8A8A8A;     /* Medium gray text */
  --text-inverse: #0A0E27;

  --border-color: rgba(255, 255, 255, 0.1);
  --border-color-light: rgba(255, 255, 255, 0.05);
  --border-color-dark: rgba(255, 255, 255, 0.15);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.4);  /* Match public site */
  --shadow-xl: 0 30px 80px rgba(0, 0, 0, 0.5);  /* Match public site */

  --overlay-bg: rgba(10, 14, 39, 0.85);

  --input-bg: rgba(10, 14, 39, 0.6);
  --input-border: rgba(255, 255, 255, 0.1);
  --input-placeholder: #8A8A8A;

  /* Update primary colors to match public site */
  --primary-blue: #0066FF;
  --primary-purple: #7C3AED;
  --button-primary: #4B5563;
  --button-primary-hover: #374151;
}

/* Force dark mode when explicitly set */
[data-theme="dark"] {
  color-scheme: dark;
}

/* Force light mode when explicitly set */
[data-theme="light"] {
  color-scheme: light;
}

/* ==================== GLOBAL STYLES ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  transition: background-color var(--transition-base), color var(--transition-base);
}

/* Ensure no gap between sidebar and main content */
/* Note: #root elements are handled by React apps themselves */
main:not(#root main), .container {
  margin-left: 0;
  padding-left: 0;
}

/* ==================== TYPOGRAPHY ==================== */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Poppins', 'Inter', sans-serif;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }
h5 { font-size: 0.875rem; }
h6 { font-size: 0.75rem; }

p {
  margin-bottom: var(--space-md);
  color: var(--text-secondary);
}

a {
  color: var(--primary-blue);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-blue-light);
  text-decoration: underline;
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  -webkit-user-select: none; /* Safari 3+ */
  user-select: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: var(--button-primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--button-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 120, 212, 0.3);
  text-decoration: none;
}

.btn-secondary {
  background: var(--button-secondary);
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--button-secondary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 137, 62, 0.3);
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary-blue);
  color: var(--primary-blue);
}

.btn-outline:hover:not(:disabled) {
  background: var(--primary-blue);
  color: white;
  box-shadow: 0 2px 8px rgba(0, 120, 212, 0.25);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-secondary);
  text-decoration: none;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.125rem;
}

/* ==================== CARDS ==================== */
.card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-orange {
  border-color: var(--accent-amber);
  background: var(--bg-card);
}

[data-theme="dark"] .card-orange {
  background: rgba(255, 185, 0, 0.05);
  border-color: rgba(255, 185, 0, 0.3);
}

[data-theme="light"] .card-orange {
  background: rgba(255, 185, 0, 0.02);
  border-color: var(--accent-amber);
}

.card-orange:hover {
  border-color: var(--accent-amber-light);
  box-shadow: 0 6px 16px rgba(255, 185, 0, 0.2);
  transform: translateY(-2px);
}

.card-green {
  border-color: var(--accent-emerald);
}

[data-theme="dark"] .card-green {
  background: rgba(16, 137, 62, 0.05);
  border-color: rgba(16, 137, 62, 0.3);
}

[data-theme="light"] .card-green {
  background: rgba(16, 137, 62, 0.02);
  border-color: var(--accent-emerald);
}

.card-green:hover {
  border-color: var(--accent-emerald-light);
  box-shadow: 0 6px 16px rgba(16, 137, 62, 0.2);
  transform: translateY(-2px);
}

.card-header {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

.card-body {
  color: var(--text-secondary);
}

/* ==================== FORMS ==================== */
.form-group {
  margin-bottom: var(--space-lg);
}

label {
  display: block;
  margin-bottom: var(--space-sm);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 0.875rem 1rem;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  background: var(--input-bg);
  color: var(--text-primary);
  border: 2px solid var(--input-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}

input::placeholder,
textarea::placeholder {
  color: var(--input-placeholder);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--input-focus);
  box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.2);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* ==================== ALERTS ==================== */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  border: 2px solid;
  margin-bottom: var(--space-lg);
  font-weight: 500;
}

.alert-success {
  background: rgba(40, 167, 69, 0.1);
  border-color: var(--success);
  color: var(--success);
}

.alert-warning {
  background: rgba(255, 193, 7, 0.1);
  border-color: var(--warning);
  color: var(--warning);
}

.alert-error {
  background: rgba(220, 53, 69, 0.1);
  border-color: var(--error);
  color: var(--error);
}

.alert-info {
  background: rgba(23, 162, 184, 0.1);
  border-color: var(--info);
  color: var(--info);
}

/* ==================== BADGES ==================== */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: var(--radius-full);
}

.badge-success {
  background: var(--success);
  color: white;
}

.badge-warning {
  background: var(--warning);
  color: var(--text-inverse);
}

.badge-error {
  background: var(--error);
  color: white;
}

.badge-info {
  background: var(--info);
  color: white;
}

.badge-orange {
  background: var(--rmon-orange);
  color: white;
}

.badge-green {
  background: var(--rmon-green);
  color: white;
}

/* ==================== CUSTOM SCROLLBAR ==================== */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-blue);
  border-radius: var(--radius-md);
  border: 2px solid var(--bg-secondary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-blue-light);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--primary-blue) var(--bg-secondary);
}

/* Safari/Chrome scrollbar */
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

*::-webkit-scrollbar-thumb {
  background: var(--primary-blue);
  border-radius: 4px;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--primary-blue-600);
}

/* ==================== MODALS ==================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--overlay-bg);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideIn 0.3s ease;
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 2px solid var(--primary-blue);
  background: var(--primary-blue);
}

.modal-header h2 {
  margin: 0;
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== THEME TOGGLE BUTTON ==================== */
.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  background: var(--bg-elevated);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 0.75rem;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-lg);
}

.theme-toggle:hover {
  transform: scale(1.05);
  border-color: var(--primary-blue);
  box-shadow: 0 4px 12px rgba(0, 120, 212, 0.3);
}

.theme-toggle svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: var(--text-primary);
  transition: all var(--transition-base);
}

/* ==================== UTILITIES ==================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-orange { color: var(--rmon-orange); }
.text-green { color: var(--rmon-green); }

.bg-primary { background: var(--bg-primary); }
.bg-secondary { background: var(--bg-secondary); }
.bg-orange { background: var(--rmon-orange); }
.bg-green { background: var(--rmon-green); }

.mt-1 { margin-top: var(--space-sm); }
.mt-2 { margin-top: var(--space-md); }
.mt-3 { margin-top: var(--space-lg); }
.mt-4 { margin-top: var(--space-xl); }

.mb-1 { margin-bottom: var(--space-sm); }
.mb-2 { margin-bottom: var(--space-md); }
.mb-3 { margin-bottom: var(--space-lg); }
.mb-4 { margin-bottom: var(--space-xl); }

.p-1 { padding: var(--space-sm); }
.p-2 { padding: var(--space-md); }
.p-3 { padding: var(--space-lg); }
.p-4 { padding: var(--space-xl); }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* ==================== UTILITY CLASSES ==================== */
/* Margin utilities */
.m-0 { margin: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mt-0 { margin-top: 0 !important; }
.mt-05 { margin-top: 0.5rem !important; }
.mt-1 { margin-top: 0.5rem !important; }
.mt-2 { margin-top: 1rem !important; }
.mr-1 { margin-right: 0.5rem !important; }
.mb-05 { margin-bottom: 0.5rem !important; }
.mb-1 { margin-bottom: 1rem !important; }
.mb-15 { margin-bottom: 1.5rem !important; }
.mb-2 { margin-bottom: 2rem !important; }

/* Padding utilities */
.p-0 { padding: 0 !important; }
.p-xs { padding: 0.25rem 0.5rem !important; }

/* Display utilities */
.hidden { display: none !important; }
.block { display: block !important; }
.inline-block { display: inline-block !important; }
.flex { display: flex !important; }

/* Flex utilities */
.items-center { align-items: center !important; }
.flex-col { flex-direction: column !important; }
.flex-1 { flex: 1 !important; }
.gap-05 { gap: 0.5rem !important; }
.gap-1 { gap: 1rem !important; }

/* Layout utilities */
.min-h-screen {
  min-height: 100vh;
}

.content-container {
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  width: 100%;
}

.theme-toggle-btn {
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
}

/* Table column width utilities */
.min-w-90 { min-width: 90px; }
.min-w-100 { min-width: 100px; }
.min-w-120 { min-width: 120px; }
.min-w-140 { min-width: 140px; }
.min-w-150 { min-width: 150px; }
.min-w-200 { min-width: 200px; }
.min-w-60 { min-width: 60px; }

/* Table styling */
.table-max-content {
  width: max-content;
}

.bg-secondary {
  background: var(--bg-secondary) !important;
}

.bg-primary {
  background: var(--bg-primary) !important;
}

/* Border utilities */
.border-b {
  border-bottom: 1px solid var(--border-color);
}

.border-t {
  border-top: 1px solid var(--border-color);
}

/* Navigation section title */
.nav-section-label {
  color: var(--text-tertiary);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-size: 0.75rem;
  margin-bottom: 0.5rem;
}

/* Code inline */
.code-inline {
  background: var(--bg-secondary);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: monospace;
}

/* Highlight box */
.highlight-box {
  background: #F0F9FF;
  padding: 15px;
  border-radius: 8px;
  border-left: 4px solid #0078D4;
  margin-bottom: 20px;
}

/* Override settings box */
.override-box {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 8px;
}

/* Override status active */
.override-status-active {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(34, 197, 94, 0.1);
  border-left: 3px solid #22c55e;
  border-radius: 4px;
}

/* Badge warning */
.badge-warning {
  background: #F59E0B;
  color: white;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  border-radius: 4px;
  display: inline-block;
}

/* Text utilities */
.text-center { text-align: center !important; }
.text-nowrap { white-space: nowrap !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-tertiary { color: var(--text-tertiary) !important; }
.text-danger { color: #ef4444 !important; }

/* Font size utilities */
.text-sm { font-size: 0.875rem !important; }
.text-xs { font-size: 0.75rem !important; }
.text-xxs { font-size: 0.8rem !important; }
.text-xl { font-size: 1.5rem !important; }
.text-base { font-size: 1rem !important; }
.text-17 { font-size: 17px !important; }
.text-20 { font-size: 20px !important; }

/* Font weight utilities */
.font-bold { font-weight: 700 !important; }
.font-semibold { font-weight: 600 !important; }

/* Width utilities */
.w-full { width: 100% !important; }

/* Cursor utilities */
.cursor-pointer { cursor: pointer !important; }
.cursor-default { cursor: default !important; }

/* Text decoration utilities */
.no-underline { text-decoration: none !important; }

/* Grid utilities */
.grid-col-full { grid-column: 1 / -1 !important; }

/* Font size specific */
.text-3xl { font-size: 3rem !important; }
.text-lg-plus { font-size: 1.125rem !important; }

/* Padding specific */
.p-3 { padding: 3rem !important; }

/* Margin specific */
.mt-3 { margin-top: 3rem !important; }
.mt-auto { margin-top: auto !important; }

/* Color utilities */
.text-success { color: #10b981 !important; }
.text-error { color: #ef4444 !important; }
.text-white { color: white !important; }
.bg-danger { background: #dc3545 !important; }
.bg-white { background: white !important; }
.border-white { border-color: white !important; }
.border-3 { border-width: 3px !important; }
.accent-green { accent-color: var(--accent-emerald) !important; }

/* Additional margin utilities for cleanup */
.mb-2 { margin-bottom: 2rem !important; }
.ml-2 { margin-left: 2rem !important; }
.ml-025 { margin-left: 0.25rem !important; }
.mx-auto { margin-left: auto !important; margin-right: auto !important; }
.my-0 { margin-top: 0 !important; margin-bottom: 0 !important; }

/* Justify utilities */
.justify-between { justify-content: space-between !important; }
.justify-center { justify-content: center !important; }
.justify-end { justify-content: flex-end !important; }

/* Gap utilities (additional) */
.gap-075 { gap: 0.75rem !important; }
.gap-2 { gap: 2rem !important; }

/* Font weight utilities */
.fw-500 { font-weight: 500 !important; }
.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }

/* Line height utilities */
.lh-14 { line-height: 1.4 !important; }
.lh-15 { line-height: 1.5 !important; }
.lh-18 { line-height: 1.8 !important; }

/* Opacity utilities */
.opacity-09 { opacity: 0.9 !important; }
.opacity-02 { opacity: 0.2 !important; }

/* Letter spacing utilities */
.tracking-3 { letter-spacing: 3px !important; }

/* Grid utilities */
.grid { display: grid !important; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr) !important; }
.align-end { align-items: end !important; }

/* Max width utilities */
.max-w-900 { max-width: 900px !important; }

/* Overflow utilities */
.overflow-x-auto { overflow-x: auto !important; }
.overflow-y-auto { overflow-y: auto !important; }

/* White space utilities */
.whitespace-nowrap { white-space: nowrap !important; }

/* Position utilities */
.relative { position: relative !important; }

/* Z-index utilities */
.z-0 { z-index: 0 !important; }
.z-1 { z-index: 1 !important; }

/* Max height utilities */
.max-h-500 { max-height: 500px !important; }
.max-h-60vh { max-height: 60vh !important; }

/* Border utilities (additional) */
.border { border: 1px solid var(--border-color) !important; }
.border-2 { border: 2px solid var(--border-color) !important; }
.border-l-3 { border-left: 3px solid !important; }
.border-l-4 { border-left: 4px solid !important; }

/* Width utilities */
.w-20 { width: 20px !important; }
.w-100 { width: 100px !important; }

/* Height utilities */
.h-20 { height: 20px !important; }

/* Min-width utilities (additional) */
.min-w-0 { min-width: 0 !important; }

/* Flex grow utilities */
.flex-grow { flex-grow: 1 !important; }

/* Flex shrink utilities */
.flex-shrink-0 { flex-shrink: 0 !important; }

/* Grid template columns utilities */
.grid-cols-auto-200 { grid-template-columns: 200px 1fr !important; }

/* Padding utilities (additional) */
.p-1 { padding: 1rem !important; }
.p-15 { padding: 1.5rem !important; }
.p-2 { padding: 2rem !important; }
.p-05 { padding: 0.5rem !important; }
.p-08 { padding: 0.8rem !important; }
.pb-1 { padding-bottom: 1rem !important; }
.pl-1 { padding-left: 1rem !important; }
.pl-05 { padding-left: 0.5rem !important; }
.pr-1 { padding-right: 1rem !important; }
.pt-1 { padding-top: 1rem !important; }

/* Margin utilities (additional) */
.m-015 { margin: 0 0 1.5rem 0 !important; }
.ml-auto { margin-left: auto !important; }
.ml-25 { margin-left: 2.5rem !important; }
.ml-30 { margin-left: 3rem !important; }
.mr-025 { margin-right: 0.25rem !important; }
.my-015 { margin-top: 1.5rem !important; margin-bottom: 1.5rem !important; }

/* Border radius utilities (additional) */
.rounded { border-radius: 0.375rem !important; }
.rounded-md { border-radius: 0.5rem !important; }
.rounded-lg { border-radius: 0.75rem !important; }

/* Flex alignment */
.items-start { align-items: flex-start !important; }

/* Border color utilities */
.border-primary { border-color: var(--primary-blue) !important; }
.border-error { border-color: var(--error) !important; }
.border-warning { border-color: #ffc107 !important; }
.border-success { border-color: #28a745 !important; }
.border-info { border-color: #17a2b8 !important; }

/* Transition utilities */
.transition-all { transition: all 0.2s !important; }

/* Gap utilities (additional) */
.gap-2 { gap: 2rem !important; }
.gap-15 { gap: 1.5rem !important; }
.gap-25 { gap: 2.5rem !important; }
.gap-8 { gap: 0.8rem !important; }

/* Table utilities */
.border-collapse { border-collapse: collapse !important; }

/* ==================== COMPONENT UTILITIES ==================== */
/* Info Box */
.info-box {
  padding: 0.75rem;
  background: rgba(0, 102, 255, 0.1);
  border-left: 3px solid var(--primary-blue);
  border-radius: 4px;
  margin-top: 1rem;
}

/* Action Button Primary */
.btn-action {
  padding: 0.5rem 1rem;
  background: var(--primary-blue);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action:hover {
  background: var(--primary-blue-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
}

/* Badge styles */
.badge {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  text-decoration: none;
  display: inline-block;
  margin-right: 0.25rem;
  border-radius: 4px;
}

.badge-danger {
  background: #ef4444;
  color: white;
}

.badge-secondary {
  background: #6b7280;
  color: white;
}

/* Progress bar */
.progress-bar {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-blue), var(--primary-blue-light));
  transition: width 0.3s ease;
}

/* Divider */
.section-divider {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--border-color);
}

/* Loading state */
.loading-state {
  text-align: center;
  padding: 3rem;
}

.loading-message {
  margin-top: 1rem;
  color: var(--text-secondary);
}

/* Error box */
.error-box {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid #ef4444;
  border-radius: 8px;
  padding: 1rem;
  color: #ef4444;
}

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

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.section-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ==================== ADDITIONAL UTILITIES (from cleanup review) ==================== */

/* Specific margins */
.mt-10 { margin-top: 10px !important; }
.mt-15 { margin-top: 15px !important; }
.mt-20 { margin-top: 20px !important; }
.mb-10 { margin-bottom: 10px !important; }
.mb-20 { margin-bottom: 20px !important; }
.ml-20 { margin-left: 20px !important; }

/* Specific padding */
.p-12 { padding: 12px !important; }
.p-14 { padding: 14px !important; }
.p-20 { padding: 20px !important; }
.p-30 { padding: 30px !important; }
.px-28 { padding-left: 28px !important; padding-right: 28px !important; }
.py-14 { padding-top: 14px !important; padding-bottom: 14px !important; }

/* Grid utilities */
.grid-auto-fit-150 {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
}

/* Max height */
.max-h-400 { max-height: 400px !important; }

/* ==================== RESPONSIVE ==================== */

/* Mobile First - Small devices (phones, 0-639px) */
@media (max-width: 639px) {
  html {
    font-size: 14px;
  }

  /* Typography - Mobile */
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1.125rem; }
  h4 { font-size: 1rem; }
  h5 { font-size: 0.875rem; }
  h6 { font-size: 0.75rem; }

  /* Spacing - Reduce on mobile */
  .content-container {
    padding: 1rem;
    max-width: 100%;
  }

  /* Buttons - Larger touch targets */
  .btn {
    padding: 0.875rem 1.25rem;
    font-size: 1rem;
    width: 100%;
    margin-bottom: 0.5rem;
  }

  .btn-sm {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }

  .btn-lg {
    padding: 1rem 1.5rem;
    font-size: 1.125rem;
  }

  /* Cards - Full width with reduced padding */
  .card {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-md);
  }

  /* Forms - Full width inputs */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="url"],
  input[type="number"],
  textarea,
  select {
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 0.875rem 0.75rem;
  }

  /* Modal - Full screen on mobile */
  .modal-content {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 1rem;
  }

  /* Theme toggle - Adjust position */
  .theme-toggle {
    top: 0.5rem;
    right: 0.5rem;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0.5rem;
  }

  .theme-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
  }

  /* Grid layouts - Stack on mobile */
  .grid-cols-2 {
    grid-template-columns: 1fr !important;
  }

  .grid-auto-fit-150 {
    grid-template-columns: 1fr !important;
  }

  /* Flex layouts - Stack on mobile */
  .flex.mobile-stack {
    flex-direction: column !important;
  }

  /* Tables - Horizontal scroll */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  /* Navigation items - Larger touch targets */
  .nav-item {
    padding: 1rem 0.75rem;
    font-size: 1rem;
  }

  /* Alerts - Smaller padding */
  .alert {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }

  /* Badge - Smaller on mobile */
  .badge {
    padding: 0.25rem 0.5rem;
    font-size: 0.625rem;
  }

  /* Utility adjustments */
  .p-3 { padding: 1.5rem !important; }
  .p-2 { padding: 1rem !important; }
  .p-1 { padding: 0.5rem !important; }

  .mt-3 { margin-top: 1.5rem !important; }
  .mt-2 { margin-top: 1rem !important; }
  .mb-3 { margin-bottom: 1.5rem !important; }
  .mb-2 { margin-bottom: 1rem !important; }

  /* Gap adjustments */
  .gap-2 { gap: 1rem !important; }
  .gap-1 { gap: 0.5rem !important; }

  /* Hide elements on mobile */
  .mobile-hide {
    display: none !important;
  }

  /* Show only on mobile */
  .mobile-show {
    display: block !important;
  }
}

/* Tablet devices (640px - 1023px) */
@media (min-width: 640px) and (max-width: 1023px) {
  html {
    font-size: 15px;
  }

  /* Typography - Tablet */
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }

  /* Content container */
  .content-container {
    padding: 1.5rem;
    max-width: 100%;
  }

  /* Buttons - Normal size */
  .btn {
    padding: 0.75rem 1.5rem;
  }

  /* Cards */
  .card {
    padding: 1.25rem;
  }

  /* Grid - 2 columns on tablet */
  .grid-auto-fit-150 {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Modal */
  .modal-content {
    max-width: 95%;
  }
}

/* Desktop and larger (1024px+) */
@media (min-width: 1024px) {
  /* Default desktop styles already defined above */
  .mobile-hide {
    display: initial !important;
  }

  .mobile-show {
    display: none !important;
  }
}

/* Large screens (1440px+) */
@media (min-width: 1440px) {
  .content-container {
    max-width: 1400px;
  }
}

/* Extra large screens (1920px+) */
@media (min-width: 1920px) {
  html {
    font-size: 18px;
  }

  .content-container {
    max-width: 1600px;
  }
}

/* Landscape orientation on mobile */
@media (max-width: 926px) and (orientation: landscape) {
  .modal-content {
    max-height: 95vh;
    overflow-y: auto;
  }

  .content-container {
    padding: 0.75rem;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Larger touch targets */
  .btn {
    min-height: 44px;
  }

  button,
  a,
  input[type="button"],
  input[type="submit"] {
    min-height: 44px;
    min-width: 44px;
  }

  /* Remove hover effects on touch devices */
  .card:hover {
    transform: none;
  }

  .btn:hover:not(:disabled) {
    transform: none;
  }

  /* Prevent text selection on buttons */
  button,
  .btn {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none; /* Safari 3+ */
    user-select: none;
  }
}

/* Print styles */
@media print {
  .theme-toggle,
  .nav-item,
  button:not(.print-visible) {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .card {
    border: 1px solid #000;
    box-shadow: none;
    page-break-inside: avoid;
  }
}

/* ==================== BUTTON TEXT COLOR - SELECTIVE ==================== */
/* Only apply white text to buttons/elements with dark backgrounds */

/* Buttons with gradient backgrounds */
.bg-gradient-to-r,
.bg-gradient-to-br,
.bg-gradient-to-l,
.bg-gradient-to-tr {
  color: white !important;
}

/* Elements with solid dark background colors (not semi-transparent) */
.bg-primary-blue-500:not([class*="bg-opacity"]),
.bg-primary-purple-500:not([class*="bg-opacity"]),
.bg-primary-blue-600,
.bg-primary-purple-600 {
  color: white !important;
}

/* Dark mode - all buttons should have white text */
[data-theme="dark"] button,
[data-theme="dark"] .btn {
  color: white;
}
