/**
 * CRITICAL FIXES - WCAG Compliance & Functional Bugs
 * Fixes color contrast violations and ensures all text is readable in all themes
 */

/* ========================================
 * PHASE 1: WCAG Color Contrast Fixes
 * ======================================== */

/* Fix Make Tonight Section - Ensure dark text in light mode */
:root.theme-aperium.mode-light .make-header,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .make-header,
:root.theme-halytic .make-header,
:root[data-ui-theme='halytic'] .make-header {
  color: var(--text, #1c1e21) !important;
}

:root.theme-aperium.mode-light .make-header .type-display,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .make-header .type-display,
:root.theme-halytic .make-header .type-display,
:root[data-ui-theme='halytic'] .make-header .type-display {
  color: var(--text, #1c1e21) !important;
}

:root.theme-aperium.mode-light .make-header .section-desc,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .make-header .section-desc,
:root.theme-halytic .make-header .section-desc,
:root[data-ui-theme='halytic'] .make-header .section-desc {
  color: var(--text-muted, #555b61) !important;
}

/* Fix Make Tonight section text colors */
:root.theme-aperium.mode-light .make-tab,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .make-tab,
:root.theme-halytic .make-tab,
:root[data-ui-theme='halytic'] .make-tab {
  color: var(--text, #1c1e21) !important;
}

:root.theme-aperium.mode-light .make-tab *,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .make-tab *,
:root.theme-halytic .make-tab *,
:root[data-ui-theme='halytic'] .make-tab * {
  color: inherit;
}

/* Fix section descriptions globally in light mode */
:root.theme-aperium.mode-light .section-desc,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .section-desc,
:root.theme-halytic .section-desc,
:root[data-ui-theme='halytic'] .section-desc {
  color: var(--text-muted, #555b61) !important;
}

/* Fix card descriptions in light mode */
:root.theme-aperium.mode-light .card-desc,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .card-desc,
:root.theme-halytic .card-desc,
:root[data-ui-theme='halytic'] .card-desc {
  color: var(--text-muted, #555b61) !important;
}

/* Fix Mocktail Builder text colors */
:root.theme-aperium.mode-light [data-tab="mocktails"],
:root[data-ui-theme='aperium'][data-bar-mode='light'] [data-tab="mocktails"],
:root.theme-halytic [data-tab="mocktails"],
:root[data-ui-theme='halytic'] [data-tab="mocktails"] {
  color: var(--text, #1c1e21) !important;
}

:root.theme-aperium.mode-light [data-tab="mocktails"] *,
:root[data-ui-theme='aperium'][data-bar-mode='light'] [data-tab="mocktails"] *,
:root.theme-halytic [data-tab="mocktails"] *,
:root[data-ui-theme='halytic'] [data-tab="mocktails"] * {
  color: inherit;
}

/* Fix Dropdown Subscription Text Visibility */
:root.theme-aperium.mode-light .bb-identity-dropdown__subscription,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .bb-identity-dropdown__subscription,
:root.theme-halytic .bb-identity-dropdown__subscription,
:root[data-ui-theme='halytic'] .bb-identity-dropdown__subscription {
  color: var(--text-muted, #555b61) !important;
  background: transparent;
}

:root.theme-aperium.mode-light .bb-identity-dropdown__subscription-plan,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .bb-identity-dropdown__subscription-plan,
:root.theme-halytic .bb-identity-dropdown__subscription-plan,
:root[data-ui-theme='halytic'] .bb-identity-dropdown__subscription-plan {
  color: var(--text, #1c1e21) !important;
  font-weight: 600;
}

:root.theme-aperium.mode-light .bb-identity-dropdown__subscription-status,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .bb-identity-dropdown__subscription-status,
:root.theme-halytic .bb-identity-dropdown__subscription-status,
:root[data-ui-theme='halytic'] .bb-identity-dropdown__subscription-status {
  color: var(--text-muted, #555b61) !important;
}

/* Fix Dropdown Scrolling - Ensure logout button is accessible */
.bb-identity-dropdown {
  max-height: 75vh !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  scroll-behavior: smooth !important;
}

/* Ensure dropdown can scroll to bottom */
.bb-identity-dropdown__item:last-child {
  margin-bottom: var(--space-xs, 8px);
}

/* Fix dropdown subscription section padding to ensure visibility */
.bb-identity-dropdown__subscription {
  padding-bottom: var(--space-sm, 12px) !important;
  background: transparent !important; /* Ensure consistent background */
}

/* Fix all body text in light mode sections */
:root.theme-aperium.mode-light .make-tab p,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .make-tab p,
:root.theme-halytic .make-tab p,
:root[data-ui-theme='halytic'] .make-tab p,
:root.theme-aperium.mode-light [data-tab="mocktails"] p,
:root[data-ui-theme='aperium'][data-bar-mode='light'] [data-tab="mocktails"] p,
:root.theme-halytic [data-tab="mocktails"] p,
:root[data-ui-theme='halytic'] [data-tab="mocktails"] p {
  color: var(--text-muted, #555b61) !important;
}

/* Fix all headings in light mode */
:root.theme-aperium.mode-light .make-tab h1,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .make-tab h1,
:root.theme-halytic .make-tab h1,
:root[data-ui-theme='halytic'] .make-tab h1,
:root.theme-aperium.mode-light .make-tab h2,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .make-tab h2,
:root.theme-halytic .make-tab h2,
:root[data-ui-theme='halytic'] .make-tab h2,
:root.theme-aperium.mode-light .make-tab h3,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .make-tab h3,
:root.theme-halytic .make-tab h3,
:root[data-ui-theme='halytic'] .make-tab h3 {
  color: var(--text, #1c1e21) !important;
}

/* Fix form labels and inputs in light mode */
:root.theme-aperium.mode-light .make-tab label,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .make-tab label,
:root.theme-halytic .make-tab label,
:root[data-ui-theme='halytic'] .make-tab label {
  color: var(--text, #1c1e21) !important;
}

/* Fix all text in Mocktail Builder tab */
:root.theme-aperium.mode-light [data-tab="mocktails"] label,
:root[data-ui-theme='aperium'][data-bar-mode='light'] [data-tab="mocktails"] label,
:root.theme-halytic [data-tab="mocktails"] label,
:root[data-ui-theme='halytic'] [data-tab="mocktails"] label {
  color: var(--text, #1c1e21) !important;
}

/* Fix Make a Drink result cards - ensure all text is visible in light mode */
:root.theme-aperium.mode-light .bb-card--result,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .bb-card--result,
:root.theme-halytic .bb-card--result,
:root[data-ui-theme='halytic'] .bb-card--result,
:root.theme-aperium.mode-light .make-results-content .bb-card,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .make-results-content .bb-card,
:root.theme-halytic .make-results-content .bb-card,
:root[data-ui-theme='halytic'] .make-results-content .bb-card {
  color: var(--text, #1c1e21) !important;
}

:root.theme-aperium.mode-light .bb-card--result .bb-card-title,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .bb-card--result .bb-card-title,
:root.theme-halytic .bb-card--result .bb-card-title,
:root[data-ui-theme='halytic'] .bb-card--result .bb-card-title,
:root.theme-aperium.mode-light .bb-card--result h3,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .bb-card--result h3,
:root.theme-halytic .bb-card--result h3,
:root[data-ui-theme='halytic'] .bb-card--result h3,
:root.theme-aperium.mode-light .bb-card--result h4,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .bb-card--result h4,
:root.theme-halytic .bb-card--result h4,
:root[data-ui-theme='halytic'] .bb-card--result h4 {
  color: var(--text, #1c1e21) !important;
}

:root.theme-aperium.mode-light .bb-card--result p,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .bb-card--result p,
:root.theme-halytic .bb-card--result p,
:root[data-ui-theme='halytic'] .bb-card--result p,
:root.theme-aperium.mode-light .bb-card--result li,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .bb-card--result li,
:root.theme-halytic .bb-card--result li,
:root[data-ui-theme='halytic'] .bb-card--result li,
:root.theme-aperium.mode-light .bb-card--result .make-result-section,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .bb-card--result .make-result-section,
:root.theme-halytic .bb-card--result .make-result-section,
:root[data-ui-theme='halytic'] .bb-card--result .make-result-section {
  color: var(--text, #1c1e21) !important;
}

:root.theme-aperium.mode-light .bb-card--result .make-result-section h4,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .bb-card--result .make-result-section h4,
:root.theme-halytic .bb-card--result .make-result-section h4,
:root[data-ui-theme='halytic'] .bb-card--result .make-result-section h4 {
  color: var(--text, #1c1e21) !important;
}

/* Fix Make a Drink page subtitle visibility in light mode */
:root.theme-aperium.mode-light .bb-page-subtitle,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .bb-page-subtitle,
:root.theme-halytic .bb-page-subtitle,
:root[data-ui-theme='halytic'] .bb-page-subtitle {
  color: var(--text-muted, rgba(15, 23, 42, 0.85)) !important;
}

/* Ensure instructions list items are visible */
:root.theme-aperium.mode-light .make-result-instructions,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .make-result-instructions,
:root.theme-halytic .make-result-instructions,
:root[data-ui-theme='halytic'] .make-result-instructions {
  color: var(--text, #1c1e21) !important;
}

:root.theme-aperium.mode-light .make-result-instructions li,
:root[data-ui-theme='aperium'][data-bar-mode='light'] .make-result-instructions li,
:root.theme-halytic .make-result-instructions li,
:root[data-ui-theme='halytic'] .make-result-instructions li {
  color: var(--text, #1c1e21) !important;
}

