/**
 * StratixPlus Enterprise Global Modern Design System
 * World-class NextGen SaaS UI elevation across ALL routes and screens
 */

:root {
  --sx-primary: #2563eb;
  --sx-primary-hover: #1d4ed8;
  --sx-primary-focus: rgba(37, 99, 235, 0.15);
  --sx-surface: #ffffff;
  --sx-surface-subtle: #f8fafc;
  --sx-border: #e2e8f0;
  --sx-border-input: #cbd5e1;
  --sx-text-main: #0f172a;
  --sx-text-muted: #64748b;
  --sx-radius-card: 20px;
  --sx-radius-btn: 10px;
  --sx-radius-input: 10px;
}

html.dark {
  --sx-surface: #0f172a;
  --sx-surface-subtle: #1e293b;
  --sx-border: #334155;
  --sx-border-input: #334155;
  --sx-text-main: #f8fafc;
  --sx-text-muted: #94a3b8;
}

/* ==========================================================================
   1. GLOBAL CARDS & CONTAINERS
   ========================================================================== */
.bg-white.dark\:bg-gray-950.border,
.bg-white.dark\:bg-gray-900.border,
div[class*="rounded-md"][class*="border-gray-200"],
div[class*="rounded-md"][class*="border-gray-700"] {
  border-radius: var(--sx-radius-card) !important;
  border: 1.5px solid var(--sx-border) !important;
  box-shadow: 0 4px 20px -3px rgba(15, 23, 42, 0.05), 0 0 0 1px rgba(15, 23, 42, 0.02) !important;
  overflow: hidden !important;
  transition: box-shadow 0.2s ease, border-color 0.2s ease !important;
}

html.dark .bg-white.dark\:bg-gray-950.border,
html.dark .bg-white.dark\:bg-gray-900.border,
html.dark div[class*="rounded-md"][class*="border-gray-200"],
html.dark div[class*="rounded-md"][class*="border-gray-700"] {
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05) !important;
}

/* Card Headers */
div[class*="border-b"][class*="border-gray-200"],
div[class*="border-b"][class*="border-gray-700"] {
  border-bottom: 1.5px solid var(--sx-border) !important;
}

/* ==========================================================================
   2. UNIFIED MODERN ACTION TOOLBAR (Eliminating the 90s Rainbow Clown Bar)
   ========================================================================== */
/* Toolbar Container */
.flex.items-center.gap-1\.5.flex-wrap.px-4.py-2\.5.bg-gray-50,
.flex.items-center.gap-1\.5.flex-wrap.px-4.py-2\.5 {
  background: var(--sx-surface-subtle) !important;
  border-bottom: 1.5px solid var(--sx-border) !important;
  padding: 12px 18px !important;
  gap: 8px !important;
}

/* Base button elevation for all maintenance toolbar buttons */
.flex.items-center.gap-1\.5.flex-wrap button,
.flex.items-center.gap-1\.5.flex-wrap a {
  height: 36px !important;
  border-radius: var(--sx-radius-btn) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 0 14px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1) !important;
  cursor: pointer !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

/* Secondary Actions: Help, Favorite, Refresh, Edit, Print, Exit */
button.bg-sky-500,
button.bg-slate-600,
button.bg-teal-500,
button.bg-amber-500,
button.bg-orange-500,
button.bg-gray-800,
button[class*="bg-sky-"],
button[class*="bg-teal-"],
button[class*="bg-amber-"],
button[class*="bg-orange-"],
button[class*="bg-gray-800"] {
  background: var(--sx-surface) !important;
  border: 1.5px solid var(--sx-border-input) !important;
  color: var(--sx-text-main) !important;
}

button.bg-sky-500:hover,
button.bg-slate-600:hover,
button.bg-teal-500:hover,
button.bg-amber-500:hover,
button.bg-orange-500:hover,
button.bg-gray-800:hover {
  background: var(--sx-surface-subtle) !important;
  border-color: #94a3b8 !important;
  color: var(--sx-primary) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 10px -2px rgba(15, 23, 42, 0.08) !important;
}

/* Primary Action: SAVE (Highlight in StratixPlus Blue) */
button.bg-emerald-500,
button[class*="bg-emerald-"] {
  background: var(--sx-primary) !important;
  border: 1.5px solid var(--sx-primary) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 12px -2px rgba(37, 99, 235, 0.35) !important;
}

button.bg-emerald-500:hover,
button[class*="bg-emerald-"]:hover {
  background: var(--sx-primary-hover) !important;
  border-color: var(--sx-primary-hover) !important;
  box-shadow: 0 6px 16px -2px rgba(37, 99, 235, 0.45) !important;
  transform: translateY(-1px) !important;
}

/* Danger Action: DELETE (Soft Rose with Hover Highlight) */
button.bg-rose-500,
button[class*="bg-rose-"] {
  background: #fff1f2 !important;
  border: 1.5px solid #fecdd3 !important;
  color: #e11d48 !important;
}

button.bg-rose-500:hover,
button[class*="bg-rose-"]:hover {
  background: #e11d48 !important;
  border-color: #e11d48 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px -2px rgba(225, 29, 72, 0.35) !important;
  transform: translateY(-1px) !important;
}

html.dark button.bg-rose-500,
html.dark button[class*="bg-rose-"] {
  background: rgba(225, 29, 72, 0.15) !important;
  border-color: rgba(225, 29, 72, 0.3) !important;
  color: #fb7185 !important;
}

/* Disabled State Elegance */
.flex.items-center.gap-1\.5.flex-wrap button:disabled,
button[disabled] {
  opacity: 0.55 !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
}

/* ==========================================================================
   3. CODE LOOKUP STRIP (Elevated Search & Browse)
   ========================================================================== */
.flex.items-center.gap-3.px-4.py-2\.5.bg-white {
  background: var(--sx-surface) !important;
  padding: 12px 18px !important;
}

.flex.items-center.gap-3.px-4.py-2\.5.bg-white label {
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  color: var(--sx-text-muted) !important;
}

.flex.items-center.gap-3.px-4.py-2\.5.bg-white input {
  height: 36px !important;
  border-radius: var(--sx-radius-input) !important;
  border: 1.5px solid var(--sx-border-input) !important;
  background: var(--sx-surface) !important;
  padding: 0 12px !important;
  font-size: 13px !important;
  color: var(--sx-text-main) !important;
  transition: all 0.15s ease !important;
}

.flex.items-center.gap-3.px-4.py-2\.5.bg-white input:focus {
  border-color: var(--sx-primary) !important;
  box-shadow: 0 0 0 3px var(--sx-primary-focus) !important;
  outline: none !important;
}

.flex.items-center.gap-3.px-4.py-2\.5.bg-white button[title*="Browse"] {
  height: 36px !important;
  width: 36px !important;
  border-radius: var(--sx-radius-btn) !important;
  background: #eff6ff !important;
  color: var(--sx-primary) !important;
  border: 1.5px solid #bfdbfe !important;
}

html.dark .flex.items-center.gap-3.px-4.py-2\.5.bg-white button[title*="Browse"] {
  background: rgba(37, 99, 235, 0.2) !important;
  border-color: rgba(37, 99, 235, 0.4) !important;
  color: #60a5fa !important;
}

/* ==========================================================================
   4. FORM INPUTS & FIELDSETS ACROSS ALL ROUTES
   ========================================================================== */
form:not(#loginForm) input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
form:not(#loginForm) select,
form:not(#loginForm) textarea,
input.cat-input,
.sx-shell input[type="text"],
.sx-shell input[type="email"],
.sx-shell input[type="password"],
.sx-shell input[type="number"],
.sx-shell input[type="date"],
.sx-shell select {
  height: 40px !important;
  border-radius: var(--sx-radius-input) !important;
  border: 1.5px solid var(--sx-border-input) !important;
  background-color: var(--sx-surface) !important;
  color: var(--sx-text-main) !important;
  font-size: 13px !important;
  padding: 0 12px !important;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1) !important;
  outline: none !important;
}

.inputwrap input,
#loginForm .inputwrap input {
  padding-left: 44px !important;
  padding-right: 44px !important;
  height: 46px !important;
  background-color: #ffffff !important;
  color: #0f172a !important;
}

form textarea {
  height: auto !important;
  min-height: 80px !important;
  padding: 10px 12px !important;
}

/* Focus States */
form input:focus,
form select:focus,
form textarea:focus,
.sx-shell input:focus,
.sx-shell select:focus {
  border-color: var(--sx-primary) !important;
  box-shadow: 0 0 0 3px var(--sx-primary-focus) !important;
}

/* Elevate Disabled Fields into Clean Readonly Cards */
form input:disabled,
form select:disabled,
form textarea:disabled {
  background-color: var(--sx-surface-subtle) !important;
  color: var(--sx-text-main) !important;
  border-color: var(--sx-border) !important;
  opacity: 0.9 !important;
  cursor: default !important;
}

/* Form Labels */
form label,
.sx-shell form label {
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  color: var(--sx-text-muted) !important;
  margin-bottom: 6px !important;
  display: block !important;
}

/* Form Section Headers */
form h2,
form h3 {
  font-size: 12px !important;
  font-weight: 800 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
  color: var(--sx-primary) !important;
  padding-bottom: 6px !important;
  border-bottom: 1.5px solid var(--sx-border) !important;
  margin-top: 18px !important;
  margin-bottom: 14px !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

form h2::before,
form h3::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 14px;
  border-radius: 2px;
  background: var(--sx-primary);
}

/* ==========================================================================
   5. TABLES ACROSS ALL MODULES
   ========================================================================== */
table.sx-table,
div[class*="overflow-x-auto"] table,
table {
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

table th {
  background: var(--sx-surface-subtle) !important;
  color: var(--sx-text-muted) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  padding: 12px 14px !important;
  border-bottom: 1.5px solid var(--sx-border) !important;
  text-align: left !important;
  white-space: nowrap !important;
}

table td {
  padding: 12px 14px !important;
  font-size: 13px !important;
  color: var(--sx-text-main) !important;
  border-bottom: 1px solid var(--sx-border) !important;
  transition: background-color 0.1s ease !important;
}

table tr:hover td {
  background-color: rgba(37, 99, 235, 0.03) !important;
}

html.dark table tr:hover td {
  background-color: rgba(37, 99, 235, 0.08) !important;
}

/* ==========================================================================
   6. STATUS CHIPS & PILLS
   ========================================================================== */
.sx-chip,
span[class*="text-green-"],
span[class*="text-emerald-"] {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  padding: 3px 10px !important;
  border-radius: 9999px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: 0.02em !important;
}

/* ==========================================================================
   7. INTERACTIVE TOGGLE SWITCH (iOS Style)
   ========================================================================== */
.cat-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.cat-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.cat-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 24px;
}

.cat-switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.cat-switch input:checked + .cat-switch-slider {
  background-color: #2563eb;
}

.cat-switch input:checked + .cat-switch-slider:before {
  transform: translateX(20px);
}

/* ==========================================================================
   8. EXECUTIVE KPI STAT CARDS & METRIC WIDGETS
   ========================================================================== */
.cat-kpi-card {
  background: var(--sx-surface);
  border: 1.5px solid var(--sx-border);
  border-radius: var(--sx-radius-card);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 4px 15px -3px rgba(15, 23, 42, 0.04), 0 0 0 1px rgba(15, 23, 42, 0.02);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}

.cat-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.08), 0 0 0 1px rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.3);
}

/* Card Grid Spacing & Gap Support */
.gap-3\.5, [class*="gap-3.5"] {
  gap: 0.875rem !important;
}
.gap-4, [class*="gap-4"] {
  gap: 1rem !important;
}
.grid:has(> .cat-kpi-card),
div[class*="grid"]:has(> .cat-kpi-card) {
  gap: 1rem !important;
}

.cat-kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.cat-kpi-card:hover .cat-kpi-icon {
  transform: scale(1.06);
}

.sx-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--sx-border);
  background: var(--sx-surface);
  color: var(--sx-text-muted);
  transition: all 0.15s ease;
}

.sx-chip:hover {
  border-color: #2563eb;
  color: #2563eb;
}

.sx-chip.active {
  background: #2563eb !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px -2px rgba(37, 99, 235, 0.35);
}

.sx-quick-item {
  padding: 12px 16px;
  border-radius: 14px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sx-quick-item:hover {
  background: var(--sx-surface-subtle);
  border-color: var(--sx-border);
}

.sx-quick-item.active {
  background: rgba(37, 99, 235, 0.06);
  border-color: #2563eb;
}

html.dark .sx-quick-item.active {
  background: rgba(37, 99, 235, 0.18);
  border-color: #3b82f6;
}

/* ==========================================================================
   9. PERFORMANCE HUB ENTERPRISE DESIGN SYSTEM
   ========================================================================== */
.sx-hub-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--sx-text-muted);
  background: transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
  border: 1.5px solid transparent;
  text-decoration: none !important;
}
.sx-hub-tab:hover {
  color: var(--sx-text-main);
  background: var(--sx-surface-subtle);
  border-color: var(--sx-border);
}
.sx-hub-tab.active {
  color: var(--sx-primary) !important;
  background: #eff6ff !important;
  border-color: #bfdbfe !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 8px -1px rgba(37, 99, 235, 0.12);
}
html.dark .sx-hub-tab.active {
  color: #60a5fa !important;
  background: rgba(37, 99, 235, 0.16) !important;
  border-color: rgba(59, 130, 246, 0.4) !important;
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.4);
}
.sx-hub-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1.5px 7px;
  border-radius: 9999px;
  background: #e2e8f0;
  color: #475569;
  letter-spacing: 0.02em;
}
html.dark .sx-hub-badge {
  background: #334155;
  color: #cbd5e1;
}
.sx-hub-tab.active .sx-hub-badge {
  background: var(--sx-primary);
  color: #ffffff;
}
.sx-hub-alert-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1.5px 7px;
  border-radius: 9999px;
  background: #fee2e2;
  color: #dc2626;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
html.dark .sx-hub-alert-badge {
  background: rgba(220, 38, 38, 0.25);
  color: #f87171;
}
.sx-kpi-metric-card {
  background: var(--sx-surface);
  border: 1.5px solid var(--sx-border);
  border-radius: 20px;
  padding: 20px;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 2px 10px -2px rgba(15, 23, 42, 0.04);
  position: relative;
  overflow: hidden;
}
.sx-kpi-metric-card:hover {
  transform: translateY(-3px);
  border-color: #93c5fd;
  box-shadow: 0 14px 30px -4px rgba(37, 99, 235, 0.09);
}
html.dark .sx-kpi-metric-card:hover {
  border-color: rgba(96, 165, 250, 0.4);
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.6);
}


