/* Mammoth Feature Prioritization - Custom Styles with Lagom Theme System */

/* ============================================
   THEME SYSTEM - 5 Balanced Themes
   ============================================ */

/* 1. Nordic Light (Default) - Clean, professional baseline */
:root,
:root[data-theme="nordic-light"] {
  /* Backgrounds */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #e9ecef;
  --bg-hover: #f1f3f5;
  
  /* Text */
  --text-primary: #212529;
  --text-secondary: #495057;
  --text-tertiary: #6c757d;
  
  /* Accent */
  --accent-primary: #5b7c99;
  --accent-hover: #4a6b85;
  --accent-light: #e8eef3;
  
  /* Status Colors */
  --critical: #c1666b;
  --high: #d98943;
  --medium: #d4a574;
  --low: #7ba3a8;
  --defer: #9ca3af;
  
  /* Borders */
  --border-light: #dee2e6;
  --border-medium: #ced4da;
  --border-dark: #adb5bd;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.10);
}

/* 2. Forest Calm - Natural greens for focused work */
:root[data-theme="forest-calm"] {
  --bg-primary: #fafaf9;
  --bg-secondary: #f4f5f3;
  --bg-tertiary: #e8ebe7;
  --bg-hover: #dfe3dd;
  
  --text-primary: #1f2e1f;
  --text-secondary: #3a4a3a;
  --text-tertiary: #5a6a5a;
  
  --accent-primary: #557153;
  --accent-hover: #445d42;
  --accent-light: #e8f0e7;
  
  --critical: #b85c5f;
  --high: #c7834a;
  --medium: #9b8b5a;
  --low: #6b8e7a;
  --defer: #8c9c8c;
  
  --border-light: #d9dfd7;
  --border-medium: #c5cfc3;
  --border-dark: #a5b5a3;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.10);
}

/* 3. Twilight Focus - Dark mode for evening work */
:root[data-theme="twilight-focus"] {
  --bg-primary: #1a1d23;
  --bg-secondary: #22252b;
  --bg-tertiary: #2a2d35;
  --bg-hover: #32353d;
  
  --text-primary: #e8eaed;
  --text-secondary: #c1c5cc;
  --text-tertiary: #9ba1a9;
  
  --accent-primary: #6b9ad4;
  --accent-hover: #5a89c3;
  --accent-light: #2d3a4a;
  
  --critical: #d97979;
  --high: #e5a567;
  --medium: #d4b878;
  --low: #7ba5b8;
  --defer: #7a8089;
  
  --border-light: #3a3d45;
  --border-medium: #4a4d55;
  --border-dark: #5a5d65;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
}

/* 4. Warm Minimal - Cozy, distraction-free */
:root[data-theme="warm-minimal"] {
  --bg-primary: #fefdfb;
  --bg-secondary: #f9f7f4;
  --bg-tertiary: #f1ede8;
  --bg-hover: #e9e4de;
  
  --text-primary: #2d2520;
  --text-secondary: #4a423d;
  --text-tertiary: #6d645f;
  
  --accent-primary: #8b6f5c;
  --accent-hover: #7a5e4b;
  --accent-light: #f0ebe6;
  
  --critical: #c17070;
  --high: #d89050;
  --medium: #c9a968;
  --low: #7e9299;
  --defer: #9a9089;
  
  --border-light: #e4dfd9;
  --border-medium: #d4cfc9;
  --border-dark: #b4afa9;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.10);
}

/* 5. Ocean Breeze - Cool, decisive clarity */
:root[data-theme="ocean-breeze"] {
  --bg-primary: #fafcfd;
  --bg-secondary: #f3f7f9;
  --bg-tertiary: #e7eff3;
  --bg-hover: #dbe7ed;
  
  --text-primary: #1a2632;
  --text-secondary: #374551;
  --text-tertiary: #5a6a76;
  
  --accent-primary: #4a7c9e;
  --accent-hover: #3a6c8e;
  --accent-light: #e6f1f7;
  
  --critical: #b86570;
  --high: #c98552;
  --medium: #9ea67d;
  --low: #5e8f9c;
  --defer: #8a9aa5;
  
  --border-light: #d8e4eb;
  --border-medium: #c8d8df;
  --border-dark: #a8b8bf;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.10);
}

/* ============================================
   TAILWIND OVERRIDES WITH THEME VARIABLES
   ============================================ */

/* Background colors - high specificity to override Tailwind */
body,
#root,
.min-h-screen {
  background-color: var(--bg-secondary) !important;
}

.bg-white,
[class*="bg-white"] {
  background-color: var(--bg-primary) !important;
}

.bg-gray-50,
[class*="bg-gray-50"] {
  background-color: var(--bg-secondary) !important;
}

.bg-gray-100,
[class*="bg-gray-100"] {
  background-color: var(--bg-tertiary) !important;
}

/* Hover states */
.hover\:bg-gray-50:hover,
[class*="hover:bg-gray-50"]:hover {
  background-color: var(--bg-hover) !important;
}

.hover\:bg-gray-100:hover,
[class*="hover:bg-gray-100"]:hover {
  background-color: var(--bg-hover) !important;
}

/* Text colors - comprehensive coverage */
h1, h2, h3, h4, h5, h6,
.text-gray-900,
.text-gray-800,
.text-gray-700,
[class*="text-gray-9"],
[class*="text-gray-8"],
[class*="text-gray-7"] {
  color: var(--text-primary) !important;
}

.text-gray-600,
[class*="text-gray-6"] {
  color: var(--text-secondary) !important;
}

.text-gray-500,
.text-gray-400,
[class*="text-gray-5"],
[class*="text-gray-4"] {
  color: var(--text-tertiary) !important;
}

/* Border colors */
.border-gray-200,
[class*="border-gray-200"] {
  border-color: var(--border-light) !important;
}

.border-gray-300,
[class*="border-gray-300"] {
  border-color: var(--border-medium) !important;
}

.border-b,
[class*="border-b"] {
  border-color: var(--border-light) !important;
}

.border-t,
[class*="border-t"] {
  border-color: var(--border-light) !important;
}

.border-l,
[class*="border-l"] {
  border-color: var(--border-light) !important;
}

.border-r,
[class*="border-r"] {
  border-color: var(--border-light) !important;
}

.divide-y > * {
  border-color: var(--border-light) !important;
}

/* Input fields */
input:not([type="checkbox"]):not([type="radio"]),
textarea,
select {
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-medium) !important;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-tertiary) !important;
  opacity: 1;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-primary) !important;
  outline-color: var(--accent-primary) !important;
}

input:disabled,
textarea:disabled,
select:disabled {
  background-color: var(--bg-tertiary) !important;
  color: var(--text-tertiary) !important;
  opacity: 0.6;
}

/* Buttons - comprehensive coverage */
button {
  transition: all 0.2s ease-in-out;
}

/* Gray/neutral buttons get theme colors */
button:not([class*="bg-blue"]):not([class*="bg-red"]):not([class*="bg-green"]):not([class*="bg-yellow"]):not([class*="bg-orange"]):not([class*="bg-purple"]):not(.tier-badge) {
  color: var(--text-primary) !important;
}

/* Border buttons */
button[class*="border-gray"] {
  border-color: var(--border-medium) !important;
  background-color: var(--bg-primary) !important;
}

button[class*="border-gray"]:hover {
  background-color: var(--bg-hover) !important;
}

/* Modal backgrounds */
[class*="fixed"][class*="inset-0"] {
  background-color: rgba(0, 0, 0, 0.5) !important;
}

/* Modal content */
[class*="fixed"][class*="inset-0"] > div {
  background-color: var(--bg-primary) !important;
}

/* Card-like containers */
.rounded-lg,
.rounded,
.shadow-sm,
.shadow,
.shadow-lg,
.shadow-xl {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* Table headers */
thead,
[role="columnheader"] {
  background-color: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
}

/* Tab navigation */
nav button,
nav a {
  color: var(--text-secondary) !important;
}

nav button[class*="border-blue"],
nav a[class*="border-blue"],
nav button.active,
nav a.active {
  color: var(--accent-primary) !important;
  border-color: var(--accent-primary) !important;
}

/* Badges and pills that aren't tier badges */
span[class*="bg-gray"]:not(.tier-badge) {
  background-color: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
}

/* Empty states and placeholders */
[class*="text-center"] p {
  color: var(--text-secondary) !important;
}

/* Links */
a:not([class*="bg-"]) {
  color: var(--accent-primary) !important;
}

a:not([class*="bg-"]):hover {
  color: var(--accent-hover) !important;
}

/* Filter icons and neutral icons */
svg:not([class*="text-blue"]):not([class*="text-red"]):not([class*="text-green"]):not([class*="text-yellow"]):not([class*="text-orange"]) {
  color: var(--text-secondary);
  stroke: currentColor;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--text-tertiary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ============================================
   THEME-AWARE UTILITY CLASSES
   ============================================ */

/* Background utilities */
.bg-theme-primary { background-color: var(--bg-primary) !important; }
.bg-theme-secondary { background-color: var(--bg-secondary) !important; }
.bg-theme-tertiary { background-color: var(--bg-tertiary) !important; }
.bg-theme-hover { background-color: var(--bg-hover) !important; }

/* Text utilities */
.text-theme-primary { color: var(--text-primary) !important; }
.text-theme-secondary { color: var(--text-secondary) !important; }
.text-theme-tertiary { color: var(--text-tertiary) !important; }

/* Accent utilities */
.bg-accent { background-color: var(--accent-primary) !important; }
.bg-accent-light { background-color: var(--accent-light) !important; }
.text-accent { color: var(--accent-primary) !important; }
.border-accent { border-color: var(--accent-primary) !important; }

.hover\:bg-accent:hover { background-color: var(--accent-hover) !important; }
.hover\:text-accent:hover { color: var(--accent-hover) !important; }

/* Border utilities */
.border-theme-light { border-color: var(--border-light) !important; }
.border-theme-medium { border-color: var(--border-medium) !important; }
.border-theme-dark { border-color: var(--border-dark) !important; }

/* Tier badge utilities using theme variables */
.tier-critical {
  background-color: var(--critical) !important;
  color: #ffffff !important;
  opacity: 0.95;
}

.tier-high {
  background-color: var(--high) !important;
  color: #ffffff !important;
  opacity: 0.95;
}

.tier-medium {
  background-color: var(--medium) !important;
  color: #ffffff !important;
  opacity: 0.95;
}

.tier-low {
  background-color: var(--low) !important;
  color: #ffffff !important;
  opacity: 0.95;
}

.tier-defer {
  background-color: var(--defer) !important;
  color: #ffffff !important;
  opacity: 0.95;
}

/* Shadow utilities */
.shadow-theme-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-theme-md { box-shadow: var(--shadow-md) !important; }
.shadow-theme-lg { box-shadow: var(--shadow-lg) !important; }

/* ============================================
   ORIGINAL STYLES (PRESERVED)
   ============================================ */

/* Loading spinner animation */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

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

/* Pulse animation for AI scoring */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Modal backdrop blur effect */
.modal-backdrop {
  backdrop-filter: blur(2px);
}

/* Hover effect transitions */
button, a, .clickable {
  transition: all 0.2s ease-in-out;
}

/* Focus visible for accessibility */
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Handsontable custom styling */
.handsontable {
  font-size: 14px;
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

.handsontable td {
  vertical-align: top;
  padding: 8px;
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

.handsontable th {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
}

/* Line clamp utilities */
.line-clamp-1 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.line-clamp-2 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* Custom tier badge styling */
.tier-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  border-width: 1px;
}

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }
}

/* Highlight animation for newly created features */
@keyframes highlight-in {
  0% { 
    background-color: #fef3c7;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.3);
  }
  100% { 
    background-color: transparent;
    box-shadow: none;
  }
}

.newly-created-feature {
  animation: highlight-in 1s ease-out;
  background-color: #fef3c7;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.3);
  transition: background-color 8s ease-out, box-shadow 8s ease-out;
}

/* Smooth transitions for theme switching */
* {
  transition-property: background-color, border-color, color;
  transition-duration: 0.3s;
  transition-timing-function: ease;
}

/* Disable transitions for animations */
.animate-spin,
.animate-pulse,
button,
a {
  transition: transform 0.2s ease !important;
}