/* Chip and Tab Components for OTE Child Theme
   Reusable button styles that match the test site design */

/* Base Variables (matching OTE design system) */
:root {
  --ote-chip-border: color-mix(in oklab, var(--border) 60%, transparent 40%);
  --ote-chip-surface: color-mix(in oklab, var(--surface) 85%, transparent 15%);
  --ote-chip-text: var(--text-tertiary);
  --ote-chip-text-active: var(--text-secondary);
  --ote-chip-muted: color-mix(in oklab, var(--surface) 92%, transparent 8%);
  --ote-chip-brand: var(--brand);
  --ote-chip-brand-light: var(--brand-subtle);
  --ote-trans-fast: var(--trans-fast);
  --ote-space-2: var(--space-2);
  --ote-space-3: var(--space-3);
}

/* Chip and Tab Container */
.ote-chips, .ote-tabs {
  display: flex;
  gap: var(--ote-space-2);
  flex-wrap: nowrap; /* Changed to nowrap for horizontal scrolling */
  align-items: center;
  overflow-x: auto; /* Enable horizontal scrolling */
  overflow-y: hidden;
  scrollbar-width: none; /* Hide scrollbar for Firefox */
  -ms-overflow-style: none; /* Hide scrollbar for IE and Edge */
  padding-bottom: 4px; /* Space for shadows */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.ote-chips::-webkit-scrollbar,
.ote-tabs::-webkit-scrollbar {
  display: none;
}

/* Base Chip and Tab Styles */
.ote-chip, .ote-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid var(--ote-chip-border);
  background: var(--ote-chip-surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ote-chip-text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--ote-trans-fast);
  user-select: none;
  white-space: nowrap;
}

/* Hover States */
.ote-chip:hover, .ote-tab:hover {
  background: var(--ote-chip-muted);
  color: var(--ote-chip-text-active);
  transform: translateY(-1px);
  text-decoration: none;
}

/* Active States with Green Glow */
.ote-chip.is-active, .ote-tab.is-active,
.ote-chip[aria-selected="true"], .ote-tab[aria-selected="true"] {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--ote-chip-muted);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--brand) 12%, transparent 88%), /* Inner ring */
              0 0 0 4px color-mix(in oklab, var(--brand) 8%, transparent 92%), /* Outer ring */
              0 0 24px color-mix(in oklab, var(--brand) 15%, transparent 85%),   /* Soft green glow */
              0 4px 12px color-mix(in oklab, var(--brand) 10%, transparent 90%);  /* Bottom shadow */
  font-weight: 600;
  transform: scale(1.02);
  transition: all 200ms cubic-bezier(.2,.6,.2,1);
}

/* Outline Variant */
.ote-chip--outline {
  background: transparent;
  border-color: var(--ote-chip-border);
}

.ote-chip--outline:hover {
  background: var(--ote-chip-muted);
  border-color: var(--ote-chip-brand);
}

/* Primary Variant */
.ote-chip--primary {
  background: var(--ote-chip-brand);
  color: var(--text-inverse);
  border-color: var(--ote-chip-brand);
}

.ote-chip--primary:hover {
  background: var(--brand-hover);
  color: var(--text-inverse);
  transform: translateY(-1px);
}

/* WordPress Button Integration - Light mode default */
:root :where(.wp-block-button.is-style-ote-chip) .wp-block-button__link,
:root :where(.wp-block-button.is-style-ote-tab) .wp-block-button__link,
body .wp-block-button.is-style-ote-chip .wp-block-button__link,
body .wp-block-button.is-style-ote-tab .wp-block-button__link,
html body .wp-block-button.is-style-ote-chip .wp-block-button__link.wp-element-button,
html body .wp-block-button.is-style-ote-tab .wp-block-button__link.wp-element-button {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  border-radius: 999px !important;
  padding: 8px 16px !important;
  border: 1px solid var(--ote-chip-border) !important;
  background: var(--ote-chip-surface) !important;
  background-color: var(--ote-chip-surface) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  color: var(--text-tertiary) !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  /* transition removed to prevent flash */
  white-space: nowrap !important;
  width: auto !important;
  line-height: 1.4 !important;
  box-shadow: none !important;
}

/* Dark mode overrides with data-theme attribute */
[data-theme="dark"] :root :where(.wp-block-button.is-style-ote-chip) .wp-block-button__link,
[data-theme="dark"] :root :where(.wp-block-button.is-style-ote-tab) .wp-block-button__link,
[data-theme="dark"] body .wp-block-button.is-style-ote-chip .wp-block-button__link,
[data-theme="dark"] body .wp-block-button.is-style-ote-tab .wp-block-button__link,
[data-theme="dark"] html body .wp-block-button.is-style-ote-chip .wp-block-button__link.wp-element-button,
[data-theme="dark"] html body .wp-block-button.is-style-ote-tab .wp-block-button__link.wp-element-button,
body[data-theme="dark"] .wp-block-button.is-style-ote-chip .wp-block-button__link,
body[data-theme="dark"] .wp-block-button.is-style-ote-tab .wp-block-button__link,
html[data-theme="dark"] body .wp-block-button.is-style-ote-chip .wp-block-button__link.wp-element-button,
html[data-theme="dark"] body .wp-block-button.is-style-ote-tab .wp-block-button__link.wp-element-button {
  border: 1px solid var(--ote-chip-border) !important;
  background: var(--ote-chip-surface) !important;
  background-color: var(--ote-chip-surface) !important;
  color: var(--ote-chip-text) !important;
}

/* Dark mode overrides with media query - DISABLED */
/* @media (prefers-color-scheme: dark) {
  :root :where(.wp-block-button.is-style-ote-chip) .wp-block-button__link,
  :root :where(.wp-block-button.is-style-ote-tab) .wp-block-button__link,
  body .wp-block-button.is-style-ote-chip .wp-block-button__link,
  body .wp-block-button.is-style-ote-tab .wp-block-button__link,
  html body .wp-block-button.is-style-ote-chip .wp-block-button__link.wp-element-button,
  html body .wp-block-button.is-style-ote-tab .wp-block-button__link.wp-element-button {
    border: 1px solid rgba(71, 85, 105, 0.4) !important;
    background: rgba(30, 41, 59, 0.6) !important;
    background-color: rgba(30, 41, 59, 0.6) !important;
    color: var(--text) !important;
  }
} */

/* Light mode hover state */
:root :where(.wp-block-button.is-style-ote-chip) .wp-block-button__link:hover,
:root :where(.wp-block-button.is-style-ote-tab) .wp-block-button__link:hover,
body .wp-block-button.is-style-ote-chip .wp-block-button__link:hover,
body .wp-block-button.is-style-ote-tab .wp-block-button__link:hover,
html body .wp-block-button.is-style-ote-chip .wp-block-button__link.wp-element-button:hover,
html body .wp-block-button.is-style-ote-tab .wp-block-button__link.wp-element-button:hover {
  background: color-mix(in oklab, var(--ote-chip-surface) 95%, transparent 5%) !important;
  background-color: color-mix(in oklab, var(--ote-chip-surface) 95%, transparent 5%) !important;
  color: var(--text-secondary) !important;
  transform: translateY(-1px) !important;
  text-decoration: none !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08) !important;
}

/* Dark mode hover state with data-theme attribute */
[data-theme="dark"] :root :where(.wp-block-button.is-style-ote-chip) .wp-block-button__link:hover,
[data-theme="dark"] :root :where(.wp-block-button.is-style-ote-tab) .wp-block-button__link:hover,
[data-theme="dark"] body .wp-block-button.is-style-ote-chip .wp-block-button__link:hover,
[data-theme="dark"] body .wp-block-button.is-style-ote-tab .wp-block-button__link:hover,
[data-theme="dark"] html body .wp-block-button.is-style-ote-chip .wp-block-button__link.wp-element-button:hover,
[data-theme="dark"] html body .wp-block-button.is-style-ote-tab .wp-block-button__link.wp-element-button:hover,
body[data-theme="dark"] .wp-block-button.is-style-ote-chip .wp-block-button__link:hover,
body[data-theme="dark"] .wp-block-button.is-style-ote-tab .wp-block-button__link:hover,
html[data-theme="dark"] body .wp-block-button.is-style-ote-chip .wp-block-button__link.wp-element-button:hover,
html[data-theme="dark"] body .wp-block-button.is-style-ote-tab .wp-block-button__link.wp-element-button:hover {
  background: color-mix(in oklab, var(--surface-hover) 86%, transparent 14%) !important;
  background-color: color-mix(in oklab, var(--surface-hover) 86%, transparent 14%) !important;
  color: var(--text-secondary) !important;
  box-shadow: 0 2px 14px color-mix(in oklab, var(--surface-active) 35%, transparent 65%) !important;
}

/* Dark mode hover state with media query - DISABLED */
/* @media (prefers-color-scheme: dark) {
  :root :where(.wp-block-button.is-style-ote-chip) .wp-block-button__link:hover,
  :root :where(.wp-block-button.is-style-ote-tab) .wp-block-button__link:hover,
  body .wp-block-button.is-style-ote-chip .wp-block-button__link:hover,
  body .wp-block-button.is-style-ote-tab .wp-block-button__link:hover,
  html body .wp-block-button.is-style-ote-chip .wp-block-button__link.wp-element-button:hover,
  html body .wp-block-button.is-style-ote-tab .wp-block-button__link.wp-element-button:hover {
    background: rgba(30, 41, 59, 0.9) !important;
    background-color: rgba(30, 41, 59, 0.9) !important;
    color: var(--text) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
  }
} */

/* Category Filter Specific Styles */
.ote-category-filters {
  margin: 20px 0;
  position: relative;
  max-width: 100%;
  overflow: hidden; /* Hide overflow but allow gradients to show */
  display: flex;
  padding: 10px; /* Add padding for glow space */
}

/* When category filters are in a flex container (like section header) */
.wp-block-group.ote-section-header .ote-category-filters {
  margin: 0;
  margin-left: auto !important; /* Force push to the right */
  flex-shrink: 0; /* Don't shrink */
  width: auto; /* Take only needed width */
}

/* Ensure filters don't get cut off in flex layouts */
.is-layout-flex .ote-category-filters,
.ote-section-header .ote-category-filters {
  overflow: hidden; /* Changed to hidden for gradient effect */
  z-index: 10; /* Ensure glow effects are visible */
}

/* Allow glow effects to extend beyond the chips container */
.ote-category-filters .ote-chips .ote-chip {
  position: relative;
  z-index: 15;
}

/* Ensure parent containers don't clip the glow */
.wp-block-group.ote-section-header {
  overflow: visible !important;
}

/* Force the shortcode wrapper to align right */
.wp-block-shortcode:has(.ote-category-filters) {
  margin-left: auto;
  display: flex;
  justify-content: flex-end;
}

/* Handle flex nowrap containers */
.is-layout-flex.is-nowrap .ote-category-filters .ote-chips {
  flex-wrap: nowrap; /* Keep single line in nowrap containers */
  overflow-x: auto; /* Allow horizontal scroll if needed */
  overflow-y: visible; /* Allow glow effects to show */
  padding: 4px 35px; /* Add horizontal padding for gradients and vertical for shadows */
  margin: 0 -35px; /* Negative margin to compensate for padding */
}

/* Make category filter chips container scrollable */
.ote-category-filters .ote-chips {
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: visible; /* Allow glow effects to show */
  scrollbar-width: none; /* Hide scrollbar for Firefox */
  -ms-overflow-style: none; /* Hide scrollbar for IE and Edge */
  padding: 4px 35px; /* Add horizontal padding for gradients and vertical for shadows */
  margin: 0 -35px; /* Negative margin to compensate for padding */
}

.ote-category-filters .ote-chips::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Chrome, Safari and Opera */
}

/* Ensure section header flex layout works properly */
.wp-block-group.ote-section-header {
  align-items: center;
  gap: 20px;
}

.wp-block-group.ote-section-header .wp-block-heading {
  flex-shrink: 0; /* Prevent heading from shrinking */
  margin: 0;
}

/* Active category filter with green glow effect - Light mode */
.ote-category-filters .ote-chip.is-active,
.ote-category-filters .ote-chip[aria-selected="true"],
.ote-category-filters .ote-chip[data-active="true"] {
  border-color: var(--brand) !important;
  color: var(--brand) !important;
  background: var(--ote-chip-muted) !important;
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--brand) 12%, transparent 88%), /* Inner ring */
              0 0 0 4px color-mix(in oklab, var(--brand) 8%, transparent 92%), /* Outer ring */
              0 0 24px color-mix(in oklab, var(--brand) 15%, transparent 85%),   /* Soft green glow */
              0 4px 12px color-mix(in oklab, var(--brand) 10%, transparent 90%) !important;  /* Bottom shadow */
  font-weight: 600 !important;
  transform: scale(1.02) !important;
  transition: all 200ms cubic-bezier(.2,.6,.2,1) !important;
}

/* Dark mode active state for category filters with dark-mode-chip class */
.ote-category-filters .ote-chip.dark-mode-chip.is-active,
.ote-category-filters .ote-chip.dark-mode-chip[aria-selected="true"] {
  border-color: var(--brand) !important;
  color: var(--brand) !important;
  background: color-mix(in oklab, var(--brand) 20%, transparent 80%) !important; /* Dark green tinted background */
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--brand-subtle) 45%, transparent 55%), /* Inner ring with bright green */
              0 0 0 4px color-mix(in oklab, var(--brand-subtle) 30%, transparent 70%),  /* Outer ring */
              0 0 30px color-mix(in oklab, var(--brand-subtle) 60%, transparent 40%),   /* Bright green glow */
              0 4px 12px rgba(0, 0, 0, 0.3) !important; /* Deeper shadow for dark mode */
  font-weight: 600 !important;
  transform: scale(1.02) !important;
}

/* Dark mode active state with data-theme attribute */
[data-theme="dark"] .ote-category-filters .ote-chip.is-active,
[data-theme="dark"] .ote-category-filters .ote-chip[aria-selected="true"] {
  border-color: var(--brand) !important;
  color: var(--app-bar-text, var(--text)) !important;
  background: color-mix(in oklab, var(--brand) 20%, transparent 80%) !important;
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--brand-subtle) 45%, transparent 55%),
              0 0 0 4px color-mix(in oklab, var(--brand-subtle) 30%, transparent 70%),
              0 0 30px color-mix(in oklab, var(--brand-subtle) 60%, transparent 40%),
              0 4px 12px rgba(0, 0, 0, 0.3) !important;
  font-weight: 600 !important;
  transform: scale(1.02) !important;
}

/* Dark mode active state with media query - DISABLED */
/* @media (prefers-color-scheme: dark) {
  .ote-category-filters .ote-chip.is-active,
  .ote-category-filters .ote-chip[aria-selected="true"] {
    border-color: var(--brand) !important;
    color: var(--brand-subtle) !important;
    background: color-mix(in oklab, var(--brand) 20%, transparent 80%) !important;
    box-shadow: 0 0 0 2px color-mix(in oklab, var(--brand-subtle) 45%, transparent 55%),
                0 0 0 4px color-mix(in oklab, var(--brand-subtle) 30%, transparent 70%),
                0 0 30px color-mix(in oklab, var(--brand-subtle) 60%, transparent 40%),
                0 4px 12px rgba(0, 0, 0, 0.3) !important;
    font-weight: 600 !important;
    transform: scale(1.02) !important;
  }
} */

/* Gradient overlays for scrollable content */
.ote-category-filters::before,
.ote-category-filters::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 30px;
  z-index: 20;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.ote-category-filters::before {
  left: 0;
  background: linear-gradient(90deg, 
    var(--bg) 0%,
    var(--bg) 20%,
    color-mix(in srgb, var(--bg) 70%, transparent) 50%,
    transparent 100%);
}

.ote-category-filters::after {
  right: 0;
  background: linear-gradient(270deg, 
    var(--bg) 0%,
    var(--bg) 20%,
    color-mix(in srgb, var(--bg) 70%, transparent) 50%,
    transparent 100%);
}

/* Gradients removed - keeping chips visible without cutoff */

/* Mobile styles and gradient visibility */
@media (max-width: 768px) {
  /* Ensure parent flex container doesn't break layout */
  .wp-block-group.is-nowrap .ote-category-filters {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow: hidden; /* Ensure gradients work on mobile */
  }
  
  .ote-category-filters {
    margin: 10px -20px 10px 0; /* Negative margin to extend to edge */
    padding-right: 20px;
    overflow: hidden; /* Ensure gradients work on mobile */
  }
  
  .ote-category-filters .ote-chips {
    padding: 4px 35px; /* Maintain padding for gradients */
    margin: 0 -35px; /* Negative margin to compensate */
  }
  
  /* Show gradients when content is scrollable */
  .ote-category-filters.has-scroll::before,
  .ote-category-filters.has-scroll::after {
    opacity: 1;
  }
  
  /* Hide left gradient when scrolled to start */
  .ote-category-filters.at-start::before {
    opacity: 0;
  }
  
  /* Hide right gradient when scrolled to end */
  .ote-category-filters.at-end::after {
    opacity: 0;
  }
}

.ote-category-filters .ote-filter-item {
  position: relative;
}

.ote-category-filters .ote-filter-item.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border: 2px solid transparent;
  border-top: 2px solid var(--ote-chip-brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0% { transform: translateY(-50%) rotate(0deg); }
  100% { transform: translateY(-50%) rotate(360deg); }
}

/* This section is now handled below */

/* Remove browser default focus outline */
.ote-chip, .ote-tab,
.ote-chip:active, .ote-tab:active,
.ote-chip:focus, .ote-tab:focus {
  outline: none !important;
  box-shadow: none !important;
}

/* Only show focus ring for keyboard navigation */
.ote-chip:focus-visible, .ote-tab:focus-visible {
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--brand) 30%, transparent 70%) !important;
}

/* Dark Mode Support - DISABLED to prevent system override */
/* @media (prefers-color-scheme: dark) {
  :root {
  --ote-chip-border: color-mix(in oklab, var(--border) 60%, transparent 40%);
  --ote-chip-surface: color-mix(in oklab, var(--surface) 75%, transparent 25%);
    --ote-chip-text: var(--text-tertiary);
    --ote-chip-text-active: color-mix(in oklab, var(--text-tertiary) 65%, var(--background) 35%);
  --ote-chip-muted: color-mix(in oklab, var(--surface) 90%, transparent 10%);
  }
} */

/* WordPress Dark Mode Data Attribute Support */
[data-theme="dark"] {
  --ote-chip-border: color-mix(in oklab, var(--border) 60%, transparent 40%);
  --ote-chip-surface: color-mix(in oklab, var(--surface) 75%, transparent 25%);
  --ote-chip-text: var(--text-tertiary);
  --ote-chip-text-active: color-mix(in oklab, var(--text-tertiary) 65%, var(--background) 35%);
  --ote-chip-muted: color-mix(in oklab, var(--surface) 90%, transparent 10%);
}

/* Dark mode support for filter buttons with data-theme attribute - ULTRA HIGH SPECIFICITY */
:root html[data-theme="dark"] body .ote-chip,
:root html[data-theme="dark"] body .ote-tab,
:root html[data-theme="dark"] body .ote-filter-item,
html body[data-theme="dark"] .ote-chip,
html body[data-theme="dark"] .ote-tab,
html body[data-theme="dark"] .ote-filter-item,
:root [data-theme="dark"] .ote-chip,
:root [data-theme="dark"] .ote-tab,
:root [data-theme="dark"] .ote-filter-item {
  border: 1px solid var(--ote-chip-border) !important;
  background: var(--ote-chip-surface) !important;
  color: var(--ote-chip-text) !important;
}

[data-theme="dark"] .ote-chip:hover,
[data-theme="dark"] .ote-tab:hover,
[data-theme="dark"] .ote-filter-item:hover,
body[data-theme="dark"] .ote-chip:hover,
body[data-theme="dark"] .ote-tab:hover,
body[data-theme="dark"] .ote-filter-item:hover,
html[data-theme="dark"] .ote-chip:hover,
html[data-theme="dark"] .ote-tab:hover,
html[data-theme="dark"] .ote-filter-item:hover {
  background: var(--ote-chip-muted) !important;
  color: var(--ote-chip-text-active) !important;
}

/* Light mode override - force light mode with ULTRA HIGH SPECIFICITY */
:root html[data-theme="light"] body .ote-chip,
:root html[data-theme="light"] body .ote-tab,
:root html[data-theme="light"] body .ote-filter-item,
html body[data-theme="light"] .ote-chip,
html body[data-theme="light"] .ote-tab,
html body[data-theme="light"] .ote-filter-item,
:root [data-theme="light"] .ote-chip,
:root [data-theme="light"] .ote-tab,
:root [data-theme="light"] .ote-filter-item,
/* Also override when no data-theme is set but system is dark */
:root html:not([data-theme="dark"]) body .ote-chip,
:root html:not([data-theme="dark"]) body .ote-tab,
:root html:not([data-theme="dark"]) body .ote-filter-item,
html body:not([data-theme="dark"]) .ote-chip,
html body:not([data-theme="dark"]) .ote-tab,
html body:not([data-theme="dark"]) .ote-filter-item {
  border: 1px solid var(--ote-chip-border) !important;
  color: var(--ote-chip-text) !important;
}

[data-theme="light"] .ote-chip:hover,
[data-theme="light"] .ote-tab:hover,
[data-theme="light"] .ote-filter-item:hover,
body[data-theme="light"] .ote-chip:hover,
body[data-theme="light"] .ote-tab:hover,
body[data-theme="light"] .ote-filter-item:hover,
html[data-theme="light"] .ote-chip:hover,
html[data-theme="light"] .ote-tab:hover,
html[data-theme="light"] .ote-filter-item:hover,
html:not([data-theme="dark"]) .ote-chip:hover,
html:not([data-theme="dark"]) .ote-tab:hover,
html:not([data-theme="dark"]) .ote-filter-item:hover {
  background: color-mix(in oklab, var(--ote-chip-surface) 95%, transparent 5%) !important;
  color: var(--text-secondary) !important;
}

/* Dark mode for WordPress chip buttons - direct styles - DISABLED */
/* @media (prefers-color-scheme: dark) {
  .wp-block-button.is-style-ote-chip .wp-block-button__link,
  .wp-block-button.is-style-ote-tab .wp-block-button__link {
    background: rgba(30, 41, 59, 0.6) !important;
    background-color: rgba(30, 41, 59, 0.6) !important;
    border: 1px solid rgba(71, 85, 105, 0.4) !important;
    color: var(--text-tertiary) !important;
  }
  
  .wp-block-button.is-style-ote-chip .wp-block-button__link:hover,
  .wp-block-button.is-style-ote-tab .wp-block-button__link:hover {
    background: rgba(30, 41, 59, 0.9) !important;
    background-color: rgba(30, 41, 59, 0.9) !important;
    color: var(--text) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
  }
} */

/* Dark mode gradients now handled by --bg variable */

/* Body class dark mode support (common pattern) */
.dark-theme,
.dark-mode,
body.dark {
  --ote-chip-border: color-mix(in oklab, var(--border) 60%, transparent 40%);
  --ote-chip-surface: color-mix(in oklab, var(--surface) 80%, transparent 20%);
  --ote-chip-text: var(--text-tertiary);
  --ote-chip-text-active: color-mix(in oklab, var(--text-secondary) 70%, var(--background) 30%);
  --ote-chip-muted: color-mix(in oklab, var(--surface) 90%, transparent 10%);
}

/* Dark mode support for filter buttons with body classes */
.dark-theme .ote-chip,
.dark-theme .ote-tab,
.dark-theme .ote-filter-item,
.dark-mode .ote-chip,
.dark-mode .ote-tab,
.dark-mode .ote-filter-item,
body.dark .ote-chip,
body.dark .ote-tab,
body.dark .ote-filter-item {
  border: 1px solid var(--ote-chip-border);
  background: var(--ote-chip-surface);
  color: var(--ote-chip-text);
}

.dark-theme .ote-chip:hover,
.dark-theme .ote-tab:hover,
.dark-theme .ote-filter-item:hover,
.dark-mode .ote-chip:hover,
.dark-mode .ote-tab:hover,
.dark-mode .ote-filter-item:hover,
body.dark .ote-chip:hover,
body.dark .ote-tab:hover,
body.dark .ote-filter-item:hover {
  background: var(--ote-chip-muted);
  color: var(--ote-chip-text-active);
}

/* Dark mode for WordPress chip buttons with data-theme */
[data-theme="dark"] .wp-block-button.is-style-ote-chip .wp-block-button__link,
[data-theme="dark"] .wp-block-button.is-style-ote-tab .wp-block-button__link,
.dark-theme .wp-block-button.is-style-ote-chip .wp-block-button__link,
.dark-theme .wp-block-button.is-style-ote-tab .wp-block-button__link,
.dark-mode .wp-block-button.is-style-ote-chip .wp-block-button__link,
.dark-mode .wp-block-button.is-style-ote-tab .wp-block-button__link,
body.dark .wp-block-button.is-style-ote-chip .wp-block-button__link,
body.dark .wp-block-button.is-style-ote-tab .wp-block-button__link {
  background: var(--ote-chip-surface) !important;
  background-color: var(--ote-chip-surface) !important;
  border: 1px solid var(--ote-chip-border) !important;
  color: var(--ote-chip-text) !important;
}

[data-theme="dark"] .wp-block-button.is-style-ote-chip .wp-block-button__link:hover,
[data-theme="dark"] .wp-block-button.is-style-ote-tab .wp-block-button__link:hover,
.dark-theme .wp-block-button.is-style-ote-chip .wp-block-button__link:hover,
.dark-theme .wp-block-button.is-style-ote-tab .wp-block-button__link:hover,
.dark-mode .wp-block-button.is-style-ote-chip .wp-block-button__link:hover,
.dark-mode .wp-block-button.is-style-ote-tab .wp-block-button__link:hover,
body.dark .wp-block-button.is-style-ote-chip .wp-block-button__link:hover,
body.dark .wp-block-button.is-style-ote-tab .wp-block-button__link:hover {
  background: var(--ote-chip-muted) !important;
  background-color: var(--ote-chip-muted) !important;
  color: var(--ote-chip-text-active) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
}

/* Body class dark mode gradients now handled by --bg variable */

/* WordPress Block Editor Dark Mode */
.editor-styles-wrapper[data-theme="dark"] .wp-block-button.is-style-ote-chip .wp-block-button__link,
.editor-styles-wrapper[data-theme="dark"] .wp-block-button.is-style-ote-tab .wp-block-button__link {
  border-color: var(--border) !important;
  background: var(--text) !important;
  color: color-mix(in oklab, var(--text-secondary) 75%, var(--background) 25%) !important;
}

.editor-styles-wrapper[data-theme="dark"] .wp-block-button.is-style-ote-chip .wp-block-button__link:hover,
.editor-styles-wrapper[data-theme="dark"] .wp-block-button.is-style-ote-tab .wp-block-button__link:hover {
  background: var(--bg-subtle) !important;
  color: color-mix(in oklab, var(--text) 15%, var(--background) 85%) !important;
}

/* Size Variants */
.ote-chip--small, .ote-tab--small {
  padding: 6px 10px;
  font-size: 12px;
}

.ote-chip--large, .ote-tab--large {
  padding: 10px 16px;
  font-size: 16px;
}

/* Responsive Adjustments */
@media (max-width: 640px) {
  .ote-chips, .ote-tabs {
    gap: 6px;
  }
  
  .ote-chip, .ote-tab {
    padding: 6px 10px;
    font-size: 13px;
  }
}

/* NUCLEAR OPTION - Override media queries with extreme specificity at the end */
:root html body .ote-chip,
:root html body .ote-tab,
:root html body .ote-filter-item {
  border: 1px solid var(--ote-chip-border) !important;
  background: var(--ote-chip-surface) !important;
  backdrop-filter: blur(10px) !important;
  color: var(--ote-chip-text) !important;
}

:root html[data-theme="dark"] body .ote-chip,
:root html[data-theme="dark"] body .ote-tab,
:root html[data-theme="dark"] body .ote-filter-item {
  border: 1px solid rgba(71, 85, 105, 0.4) !important;
  background: rgba(30, 41, 59, 0.6) !important;
  backdrop-filter: blur(10px) !important;
  color: var(--text-tertiary) !important;
}

:root html body .ote-chip:hover,
:root html body .ote-tab:hover,
:root html body .ote-filter-item:hover {
  background: color-mix(in oklab, var(--ote-chip-surface) 95%, transparent 5%) !important;
  color: var(--text-secondary) !important;
}

:root html[data-theme="dark"] body .ote-chip:hover,
:root html[data-theme="dark"] body .ote-tab:hover,
:root html[data-theme="dark"] body .ote-filter-item:hover {
  background: rgba(30, 41, 59, 0.9) !important;
  color: color-mix(in oklab, var(--text-tertiary) 65%, var(--background) 35%) !important;
}
