/* ===================================================================
   IGNY8 CUSTOM COLOR SCHEME
   ===================================================================
   This file contains IGNY8 brand colors from WordPress plugin.
   All classes use 'igny8-' prefix to avoid conflicts with TailAdmin defaults.
   Import this file separately to keep TailAdmin updates from affecting it.
   
   🔒 DESIGN SYSTEM LOCKED - See DESIGN_SYSTEM.md for complete style guide
   
   IMPORTANT: Before adding new CSS classes, check DESIGN_SYSTEM.md to ensure
   you're not duplicating existing functionality. All visual styling patterns
   are documented and locked.
   =================================================================== */

/* === CSS CUSTOM PROPERTIES (Variables) === */
:root {
  /* Primary Brand Colors */
  --igny8-blue: #0693e3;           /* Rocket vivid cyan blue - primary brand & main CTA */
  --igny8-blue-dark: #0472b8;      /* Darkened cyan for hover / active / gradient depth */
  
  /* Success Green (cooler to match cyan) */
  --igny8-green: #0bbf87;          /* Slightly cooler teal-green for success states */
  --igny8-green-dark: #08966b;     /* Deeper teal-green for hover / active */
  
  /* Amber / Warning (warmed up to complement cyan) */
  --igny8-amber: #ff7a00;          /* Rocket's vivid orange for highlight / warning */
  --igny8-amber-dark: #cc5f00;     /* Darker orange for hover / strong warning */
  
  /* Danger / Destructive */
  --igny8-red: #ef4444;
  --igny8-red-dark: #d13333;       /* Refreshed red with better contrast against cyan */
  
  /* Purple */
  --igny8-purple: #5d4ae3;         /* Purple for highlighting / special emphasis */
  --igny8-purple-dark: #3a2f94;    /* Darker purple for hover / active */
  
  /* Background Colors */
  --igny8-navy-bg: #0d1b2a;        /* Sidebar background */
  --igny8-navy-bg-2: #142b3f;      /* Slightly lighter navy, hover/active */
  --igny8-surface: #f8fafc;        /* Page background (soft gray-white) */
  --igny8-panel: #ffffff;          /* Cards / panel foreground */
  --igny8-panel-2: #f1f5f9;        /* Sub-panel / hover card background */
  
  /* Text Colors */
  --igny8-text: #555a68;           /* main headings/body text */
  --igny8-text-dim: #64748b;       /* secondary/subtext */
  --igny8-text-light: #e5eaf0;     /* text on dark sidebar */
  --igny8-stroke: #e2e8f0;         /* table/grid borders and dividers */
  
  /* Border Radius */
  --igny8-radius: 6px;
  
  /* Gradients */
  --igny8-gradient-blue: linear-gradient(135deg, var(--igny8-blue) 0%, var(--igny8-blue-dark) 100%);
  --igny8-gradient-success: linear-gradient(135deg, var(--igny8-green) 0%, var(--igny8-green-dark) 100%);
  --igny8-gradient-warning: linear-gradient(135deg, var(--igny8-amber) 0%, var(--igny8-amber-dark) 100%);
  --igny8-gradient-danger: linear-gradient(135deg, var(--igny8-red) 0%, var(--igny8-red-dark) 100%);
  --igny8-gradient-purple: linear-gradient(135deg, var(--igny8-purple) 0%, var(--igny8-purple-dark) 100%);
  --igny8-gradient-panel: linear-gradient(180deg, var(--igny8-panel) 0%, var(--igny8-panel-2) 100%);
}

/* Dark mode overrides (if needed) */
.dark {
  --igny8-surface: #1f2937;
  --igny8-panel: #1f2937;
  --igny8-panel-2: #111827;
  --igny8-text: #e5eaf0;
  --igny8-text-dim: #9ca3af;
  --igny8-stroke: #374151;
}

/* ===================================================================
   IGNY8 UTILITY CLASSES
   ===================================================================
   Use these classes instead of Tailwind defaults for IGNY8 branding.
   Example: Use 'igny8-bg-blue' instead of 'bg-brand-500'
   =================================================================== */

/* === Background Colors === */
.igny8-bg-blue { background-color: var(--igny8-blue); }
.igny8-bg-blue-dark { background-color: var(--igny8-blue-dark); }
.igny8-bg-green { background-color: var(--igny8-green); }
.igny8-bg-green-dark { background-color: var(--igny8-green-dark); }
.igny8-bg-amber { background-color: var(--igny8-amber); }
.igny8-bg-amber-dark { background-color: var(--igny8-amber-dark); }
.igny8-bg-red { background-color: var(--igny8-red); }
.igny8-bg-red-dark { background-color: var(--igny8-red-dark); }
.igny8-bg-purple { background-color: var(--igny8-purple); }
.igny8-bg-purple-dark { background-color: var(--igny8-purple-dark); }
.igny8-bg-navy { background-color: var(--igny8-navy-bg); }
.igny8-bg-navy-2 { background-color: var(--igny8-navy-bg-2); }
.igny8-bg-surface { background-color: var(--igny8-surface); }
.igny8-bg-panel { background-color: var(--igny8-panel); }
.igny8-bg-panel-2 { background-color: var(--igny8-panel-2); }

/* === Text Colors === */
.igny8-text-blue { color: var(--igny8-blue); }
.igny8-text-blue-dark { color: var(--igny8-blue-dark); }
.igny8-text-green { color: var(--igny8-green); }
.igny8-text-green-dark { color: var(--igny8-green-dark); }
.igny8-text-amber { color: var(--igny8-amber); }
.igny8-text-amber-dark { color: var(--igny8-amber-dark); }
.igny8-text-red { color: var(--igny8-red); }
.igny8-text-red-dark { color: var(--igny8-red-dark); }
.igny8-text-purple { color: var(--igny8-purple); }
.igny8-text-purple-dark { color: var(--igny8-purple-dark); }
.igny8-text-primary { color: var(--igny8-text); }
.igny8-text-dim { color: var(--igny8-text-dim); }
.igny8-text-light { color: var(--igny8-text-light); }

/* === Border Colors === */
.igny8-border-blue { border-color: var(--igny8-blue); }
.igny8-border-blue-dark { border-color: var(--igny8-blue-dark); }
.igny8-border-green { border-color: var(--igny8-green); }
.igny8-border-amber { border-color: var(--igny8-amber); }
.igny8-border-red { border-color: var(--igny8-red); }
.igny8-border-purple { border-color: var(--igny8-purple); }
.igny8-border-stroke { border-color: var(--igny8-stroke); }

/* === Gradient Backgrounds === */
.igny8-gradient-blue { background: var(--igny8-gradient-blue); }
.igny8-gradient-success { background: var(--igny8-gradient-success); }
.igny8-gradient-warning { background: var(--igny8-gradient-warning); }
.igny8-gradient-danger { background: var(--igny8-gradient-danger); }
.igny8-gradient-purple { background: var(--igny8-gradient-purple); }
.igny8-gradient-panel { background: var(--igny8-gradient-panel); }

/* === Border Radius === */
.igny8-rounded { border-radius: var(--igny8-radius); }
.igny8-rounded-xl { border-radius: calc(var(--igny8-radius) * 2); }
.igny8-rounded-2xl { border-radius: calc(var(--igny8-radius) * 3); }

/* === Hover States === */
.igny8-hover-blue:hover { background-color: var(--igny8-blue-dark); }
.igny8-hover-green:hover { background-color: var(--igny8-green-dark); }
.igny8-hover-amber:hover { background-color: var(--igny8-amber-dark); }

/* === Card Styles (matching WordPress plugin) === */
.igny8-card {
  background: var(--igny8-panel);
  border: 1px solid var(--igny8-stroke);
  border-radius: var(--igny8-radius);
  padding: 18px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.10), 0 4px 10px rgba(13, 27, 42, 0.06);
  transition: box-shadow 0.25s ease, transform 0.2s ease;
}

.igny8-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.14), 0 8px 20px rgba(13, 27, 42, 0.10);
}

.igny8-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  background: var(--igny8-gradient-blue);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--igny8-radius) var(--igny8-radius) 0 0;
  margin: -10px -10px 12px -10px;
}

/* === Button Styles === */
.igny8-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  border: none;
  border-radius: var(--igny8-radius);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  margin: 0 5px;
}

.igny8-btn-primary {
  background: var(--igny8-blue);
}

.igny8-btn-primary:hover {
  background: var(--igny8-blue-dark);
}

.igny8-btn-success {
  background: var(--igny8-green);
}

.igny8-btn-success:hover {
  background: var(--igny8-green-dark);
}

.igny8-btn-warning {
  background: var(--igny8-amber);
}

.igny8-btn-warning:hover {
  background: var(--igny8-amber-dark);
}

.igny8-btn-danger {
  background: var(--igny8-red);
}

.igny8-btn-danger:hover {
  opacity: 0.9;
}

/* === Badge Styles === */
.igny8-badge {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  display: inline-block;
}

.igny8-badge-primary { background: var(--igny8-blue); }
.igny8-badge-success { background: var(--igny8-green); }
.igny8-badge-warning { background: var(--igny8-amber); }
.igny8-badge-danger { background: var(--igny8-red); }
.igny8-badge-purple { background: var(--igny8-purple); }

/* ===================================================================
   COMPACT LAYOUT STYLES (Global - Apply to all pages)
   =================================================================== */

/* === Table Compact Styles === */
/* Table header styling - larger font, taller height, differentiated from body */
.igny8-table-compact th {
  padding: 12px 16px !important; /* Increased height for headers */
  font-size: 14px !important; /* Larger font for headers */
  font-weight: 600 !important;
  color: #475467 !important; /* gray-600 - darker for better visibility */
  text-align: left !important;
  background-color: #f8fafc !important; /* Light gray background */
  border-bottom: 2px solid #e2e8f0 !important; /* Thicker bottom border */
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.dark .igny8-table-compact th {
  color: #e5eaf0 !important; /* Lighter text for dark mode */
  background-color: rgba(15, 23, 42, 0.5) !important; /* Dark gray background */
  border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

/* Table body cell styling - reduced padding for data density */
.igny8-table-compact td {
  padding: 4px 12px !important; /* Reduced padding for body cells */
  font-size: 14px !important; /* Consistent size across all cells */
  border-bottom: 1px solid #e2e8f0 !important;
}

.dark .igny8-table-compact td {
  border-bottom-color: rgba(255, 255, 255, 0.05) !important;
}

/* === Compact Input/Select Styles === */
.igny8-input-compact,
.igny8-select-compact {
  height: 36px !important; /* Reduced from h-11 (44px) */
  padding: 6px 12px !important; /* Reduced padding */
  font-size: 13px !important;
}

/* === Compact Button Styles === */
.igny8-btn-compact {
  padding: 6px 12px !important;
  font-size: 13px !important;
  height: 36px !important;
}

.igny8-btn-compact-sm {
  padding: 4px 10px !important;
  font-size: 12px !important;
  height: 32px !important;
}

/* === Styled Dropdown/Select === */
.igny8-select-styled {
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23647085' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  padding-right: 36px !important;
}

.dark .igny8-select-styled {
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%2398A2B3' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}

/* Native select dropdown styling (limited but improved) */
select.igny8-select-styled {
  cursor: pointer;
}

select.igny8-select-styled option {
  padding: 10px 12px !important;
  background: #fff !important;
  color: #334054 !important;
  font-size: 13px !important;
}

select.igny8-select-styled option:hover {
  background: #f1f5f9 !important;
}

select.igny8-select-styled option:checked {
  background: #ede9fe !important;
  color: #5d4ae3 !important;
  font-weight: 600 !important;
}

.dark select.igny8-select-styled option {
  background: #1f2937 !important;
  color: #e5eaf0 !important;
}

.dark select.igny8-select-styled option:hover {
  background: #374151 !important;
}

.dark select.igny8-select-styled option:checked {
  background: #3a2f94 !important;
  color: #e9d5ff !important;
}

/* === Header Metrics Bar (compact, right-aligned) === */
.igny8-header-metrics {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 6px 12px;
  background: transparent;
  border-radius: 6px;
  box-shadow: 0 2px 6px 3px rgba(0, 0, 0, 0.08);
}

.dark .igny8-header-metrics {
  background: transparent;
  box-shadow: 0 2px 6px 3px rgba(0, 0, 0, 0.08);
}

.igny8-header-metric {
  display: flex;
  align-items: center;
  gap: 8px;
}

.igny8-header-metric-separator {
  width: 1px;
  height: 16px;
  background: rgb(203 213 225); /* slate-300 */
  opacity: 0.4;
}

.dark .igny8-header-metric-separator {
  background: rgb(148 163 184); /* slate-400 */
  opacity: 0.3;
}

.igny8-header-metric-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgb(100 116 139); /* slate-500 */
}

.dark .igny8-header-metric-label {
  color: rgb(148 163 184); /* slate-400 */
}

.igny8-header-metric-value {
  font-size: 14px;
  font-weight: 700;
  color: rgb(30 41 59); /* slate-800 */
  margin-left: 4px;
}

.dark .igny8-header-metric-value {
  color: #fff;
}

.igny8-header-metric-accent {
  width: 2px;
  height: 14px;
  border-radius: 2px;
}

.igny8-header-metric-accent.blue {
  background: var(--igny8-blue);
}

.igny8-header-metric-accent.green {
  background: var(--igny8-green);
}

.igny8-header-metric-accent.amber {
  background: var(--igny8-amber);
}

.igny8-header-metric-accent.purple {
  background: var(--igny8-purple);
}

/* === Difficulty Badge Special Styling === */
.difficulty-badge {
  border-radius: 3px !important;
  min-width: 28px !important;
  display: inline-flex !important;
  justify-content: center !important;
  align-items: center !important;
}

/* Very Hard (5) - Darker error background (not maroon, just darker error red) */
.difficulty-badge.difficulty-very-hard {
  background-color: #dc2626 !important; /* red-600 - darker than bg-error-500 (red-500) */
  color: #fff !important;
}

.dark .difficulty-badge.difficulty-very-hard {
  background-color: #dc2626 !important; /* red-600 - darker error */
  color: #fff !important;
}

/* Center align Difficulty column header and cells */
.igny8-table-compact th.text-center {
  text-align: center !important;
}

.igny8-table-compact td.text-center {
  text-align: center !important;
}

/* Smooth Table Height Transitions - Improved */
.igny8-table-container {
  min-height: 500px; /* Stable height during loading */
  transition: min-height 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden; /* Prevent scrollbar jumping during loading */
  /* Force layout stability */
  will-change: min-height;
}

.igny8-table-container.loading {
  min-height: 500px;
  overflow: hidden !important; /* Force hide all scrollbars during loading */
  /* Prevent any layout shifts */
  contain: layout style paint;
}

.igny8-table-container.loaded {
  min-height: auto;
  overflow: visible;
  transition: min-height 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  /* Smooth reveal */
  animation: fadeInContainer 0.3s ease-out;
}

@keyframes fadeInContainer {
  from {
    opacity: 0.95;
  }
  to {
    opacity: 1;
  }
}

/* Table wrapper to prevent horizontal scrollbar jumping */
.igny8-table-wrapper {
  width: 100%;
  position: relative;
  /* Initially hide scrollbars completely */
  overflow-x: hidden;
  overflow-y: hidden;
  /* Smooth scrollbar appearance */
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
  transition: opacity 0.4s ease-in-out;
  /* Prevent layout shift */
  contain: layout;
}

/* Hide scrollbars during loading - use multiple approaches */
.igny8-table-container.loading .igny8-table-wrapper {
  overflow-x: hidden !important; /* Force hide horizontal scroll */
  overflow-y: hidden !important;
  /* Hide scrollbar track */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.igny8-table-container.loading .igny8-table-wrapper::-webkit-scrollbar {
  display: none !important; /* Hide webkit scrollbars */
  width: 0 !important;
  height: 0 !important;
}

.igny8-table-container.loaded .igny8-table-wrapper {
  overflow-x: auto; /* Show scrollbar only when loaded and stable */
  overflow-y: hidden;
  /* Smooth scrollbar fade-in */
  animation: showScrollbar 0.4s ease-out 0.3s both;
}

@keyframes showScrollbar {
  from {
    scrollbar-width: none;
  }
  to {
    scrollbar-width: thin;
  }
}

/* Ensure table has stable width from start */
.igny8-table-smooth {
  width: 100%;
  table-layout: fixed; /* Use fixed layout for stability */
  min-width: 100%; /* Prevent width jumping */
  transition: opacity 0.5s ease-in-out;
  /* Prevent layout shifts */
  contain: layout;
}

.igny8-table-container.loading .igny8-table-smooth {
  opacity: 0.8;
  /* Force stable rendering */
  visibility: visible;
}

.igny8-table-container.loaded .igny8-table-smooth {
  opacity: 1;
  table-layout: auto; /* Switch to auto after loaded for better column sizing */
  transition: opacity 0.5s ease-in-out, table-layout 0.1s ease-out;
}

/* Table body transitions */
.igny8-table-body {
  position: relative;
  min-height: 450px; /* Fixed minimum height during loading */
  transition: min-height 0.8s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease-in-out;
  /* Prevent layout shifts */
  contain: layout;
}

.igny8-table-container.loading .igny8-table-body {
  min-height: 450px;
  opacity: 1;
  /* Lock height during transition */
  height: auto;
}

.igny8-table-container.loaded .igny8-table-body {
  min-height: 0;
  opacity: 1;
  /* Smooth height adjustment */
  transition: min-height 0.8s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease-in-out;
}

/* Smooth fade transition between skeleton and content */
.igny8-table-container.loading .igny8-table-body > tr:not(.igny8-skeleton-row) {
  display: none !important; /* Force hide data rows during loading */
  visibility: hidden;
}

.igny8-table-container.loaded .igny8-table-body > tr.igny8-skeleton-row {
  display: none !important; /* Force hide skeleton rows after loading */
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

/* Smooth row appearance for data rows */
.igny8-data-row {
  animation: fadeInRow 0.6s ease-out forwards;
  opacity: 0;
  /* Smooth entrance */
  transform: translateY(8px);
}

@keyframes fadeInRow {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Disable animation for skeleton rows */
.igny8-skeleton-row {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
  /* Keep visible during loading */
  display: table-row !important;
}

/* Prevent any flash of unstyled content */
.igny8-table-container.loading * {
  /* Prevent any content jumps */
  backface-visibility: hidden;
  perspective: 1000px;
}
