/**
 * FireBreak Glassmorphic Theme
 * Shared visual treatment for all inspection paths
 * Requires: styles/themes/bacchus.css (design tokens)
 * Applied via: body.theme-bacchus or [data-theme="bacchus"]
 */

/* ==============================================
   1. BASE BODY OVERRIDES
   ============================================== */

body.theme-bacchus,
body[data-theme="bacchus"] {
  background: #ffffff !important;
  color: #0f172a !important;
  position: relative;
  overflow-x: hidden;
}

/* Override dark border colors */
.theme-bacchus *:not(.status-dot):not(svg):not(path):not(i) {
  border-color: var(--glass-border, rgba(226, 232, 240, 0.5));
}

/* ==============================================
   2. AMBIENT GLOW BACKGROUNDS
   ============================================== */

body.theme-bacchus::before,
body.theme-bacchus::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

body.theme-bacchus::before {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #f59e0b 0%, transparent 70%);
  top: -200px;
  right: -200px;
  animation: glass-drift 20s ease-in-out infinite;
}

body.theme-bacchus::after {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #3b82f6 0%, transparent 70%);
  bottom: -150px;
  left: -150px;
  animation: glass-drift 25s ease-in-out infinite reverse;
}

@keyframes glass-drift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(30px, 30px); }
}

/* ==============================================
   3. GLASSMORPHIC HEADER
   ============================================== */

.theme-bacchus .app-header {
  background: var(--glass-bg-elevated, rgba(255, 255, 255, 0.85)) !important;
  backdrop-filter: blur(var(--glass-blur, 12px)) !important;
  -webkit-backdrop-filter: blur(var(--glass-blur, 12px)) !important;
  border-bottom: 1px solid rgba(203, 213, 225, 0.3) !important;
  box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.05)) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

/* Status indicator in header */
.theme-bacchus .app-header .status-indicator,
.theme-bacchus .app-header .network-badge {
  background: rgba(248, 250, 252, 0.8) !important;
  border: 1px solid var(--glass-border, rgba(226, 232, 240, 0.5)) !important;
  color: #0f172a !important;
}

/* End session link */
.theme-bacchus .app-header .end-session-link {
  color: #64748b !important;
}

.theme-bacchus .app-header .end-session-link:hover {
  color: var(--color-cta, #f59e0b) !important;
}

/* ==============================================
   4. HEADER WORDMARK & ICON
   ============================================== */

/* Icon container (multiple class names for cross-page compatibility) */
.theme-bacchus .header-icon-container,
.theme-bacchus .glass-icon-container,
.theme-bacchus .app-header-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(248, 250, 252, 0.8);
  border: 1px solid var(--glass-border, rgba(226, 232, 240, 0.5));
  border-radius: 12px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Smaller icon variant for zones pages */
.theme-bacchus .app-header-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

/* Wordmark container */
.theme-bacchus .app-header-wordmark,
.theme-bacchus .glass-wordmark {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

/* Wordmark title */
.theme-bacchus .header-wordmark,
.theme-bacchus .wordmark-title,
.theme-bacchus .glass-wordmark-brand {
  color: #0f172a !important;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
}

/* Ensure header left text is dark */
.theme-bacchus .app-header-left span {
  color: #0f172a;
}

.theme-bacchus .header-wordmark .brand-accent,
.theme-bacchus .wordmark-accent,
.theme-bacchus .glass-wordmark-sub {
  color: var(--color-cta, #f59e0b) !important;
  font-weight: 300;
}

.theme-bacchus .header-subtitle,
.theme-bacchus .wordmark-subtitle,
.theme-bacchus .glass-wordmark-subtitle {
  color: #64748b !important;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  line-height: 1;
}

/* Header left flex layout */
.theme-bacchus .app-header-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
}

/* ==============================================
   5. GLASSMORPHIC CONTAINERS
   ============================================== */

.theme-bacchus .main-content,
.theme-bacchus #screen-container,
.theme-bacchus .screen {
  position: relative;
  z-index: 1;
  background: transparent !important;
}

.theme-bacchus .section {
  background: var(--glass-bg, rgba(255, 255, 255, 0.7)) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border, rgba(226, 232, 240, 0.5)) !important;
  border-radius: 12px;
  box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.05)) !important;
}

.theme-bacchus .section-title {
  color: #0f172a !important;
}

/* ==============================================
   6. HERO & LANDING
   ============================================== */

.theme-bacchus .hero-section {
  background: transparent !important;
  padding: 60px 20px !important;
}

.theme-bacchus .hero-title {
  color: #0f172a !important;
  font-weight: 700;
  font-size: 2.5rem !important;
  margin-bottom: 2rem !important;
}

/* ==============================================
   7. FORM ELEMENTS
   ============================================== */

/* Address input container */
.theme-bacchus .address-input-container {
  background: var(--glass-bg, rgba(255, 255, 255, 0.7)) !important;
  backdrop-filter: blur(var(--glass-blur, 12px)) !important;
  -webkit-backdrop-filter: blur(var(--glass-blur, 12px)) !important;
  border: 1px solid var(--glass-border, rgba(226, 232, 240, 0.5)) !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(245, 158, 11, 0.1) !important;
  border-radius: 12px !important;
  overflow: hidden;
}

.theme-bacchus .address-input {
  background: transparent !important;
  color: #0f172a !important;
  border: none !important;
}

.theme-bacchus .address-input::placeholder {
  color: #94a3b8 !important;
}

/* Search Here button */
.theme-bacchus .search-here-button {
  background: var(--color-cta, #f59e0b) !important;
  border: none !important;
  color: white !important;
  font-weight: 600;
  box-shadow: 0 10px 15px -3px rgba(245, 158, 11, 0.25) !important;
  transition: all 0.2s !important;
}

.theme-bacchus .search-here-button:hover {
  background: var(--color-cta-hover, #d97706) !important;
  box-shadow: 0 10px 15px -3px rgba(245, 158, 11, 0.35) !important;
  transform: translateY(-1px);
}

/* Autocomplete dropdown */
.theme-bacchus .autocomplete-dropdown {
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(var(--glass-blur, 12px)) !important;
  -webkit-backdrop-filter: blur(var(--glass-blur, 12px)) !important;
  border: 1px solid var(--glass-border, rgba(226, 232, 240, 0.5)) !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important;
  max-height: 0 !important;
  overflow: hidden !important;
}

body.theme-bacchus .autocomplete-dropdown.active,
.theme-bacchus .autocomplete-dropdown.active,
#autocompleteDropdown.active {
  max-height: 400px !important;
  min-height: 100px !important;
  opacity: 1 !important;
  overflow-y: auto !important;
  display: flex !important;
  flex-direction: column !important;
  gap: var(--space-2, 8px) !important;
  padding: var(--space-1, 4px) !important;
}

/* Select elements */
.theme-bacchus select {
  background: rgba(248, 250, 252, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border, rgba(226, 232, 240, 0.5));
  color: #0f172a;
  border-radius: 8px;
}

/* ==============================================
   8. BUTTONS
   ============================================== */

/* Primary CTA - Amber */
.theme-bacchus .btn-primary {
  background: var(--color-cta, #f59e0b) !important;
  color: white !important;
  border: none !important;
  box-shadow: 0 10px 15px -3px rgba(245, 158, 11, 0.25) !important;
  transition: all 0.2s !important;
}

.theme-bacchus .btn-primary:hover:not(:disabled) {
  background: var(--color-cta-hover, #d97706) !important;
  box-shadow: 0 10px 15px -3px rgba(245, 158, 11, 0.35) !important;
  transform: translateY(-1px);
}

.theme-bacchus .btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Secondary button - Glassmorphic */
.theme-bacchus .btn-secondary {
  background: rgba(248, 250, 252, 0.7) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  color: #64748b !important;
  border: 1px solid var(--glass-border, rgba(226, 232, 240, 0.5)) !important;
}

.theme-bacchus .btn-secondary:hover:not(:disabled) {
  background: rgba(241, 245, 249, 0.9) !important;
  color: #0f172a !important;
}

/* Feedback & share buttons */
.theme-bacchus .btn-feedback,
.theme-bacchus .btn-share,
.theme-bacchus .toggle-btn {
  background: rgba(248, 250, 252, 0.8) !important;
  border: 1px solid var(--glass-border, rgba(226, 232, 240, 0.5)) !important;
  color: #0f172a !important;
}

.theme-bacchus .btn-feedback:hover,
.theme-bacchus .btn-share:hover,
.theme-bacchus .toggle-btn:hover {
  background: rgba(248, 250, 252, 1) !important;
  transform: translateY(-1px);
}

/* Submit / download buttons */
.theme-bacchus .btn-submit-feedback,
.theme-bacchus #download-certificate {
  background: var(--color-cta, #f59e0b) !important;
  border: 1px solid var(--color-cta-hover, #d97706) !important;
  color: white !important;
}

/* ==============================================
   9. ADDRESS CONFIRM - FULL-BLEED MAP
   ============================================== */

/* Full-bleed map pages need overflow hidden on body and fixed main content */
body.theme-bacchus:has(.address-confirm-container) {
  overflow: hidden !important;
}

body.theme-bacchus:has(.address-confirm-container) .main-content {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0;
  margin: 0;
}

.theme-bacchus .address-confirm-container {
  position: relative;
  width: 100%;
  height: 100%;
}

.theme-bacchus .map-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  margin: 0;
  border-radius: 0;
  overflow: hidden;
}

.theme-bacchus #map {
  width: 100%;
  height: 100%;
}

/* Floating CTA module */
.theme-bacchus .address-cta-module {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: var(--glass-bg-elevated, rgba(255, 255, 255, 0.85));
  backdrop-filter: blur(var(--glass-blur, 12px));
  -webkit-backdrop-filter: blur(var(--glass-blur, 12px));
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
  padding: 20px 16px calc(env(safe-area-inset-bottom, 16px) + 16px);
  max-height: 50vh;
  overflow-y: auto;
  border-radius: 16px 16px 0 0;
  border-top: 1px solid var(--glass-border, rgba(226, 232, 240, 0.5));
}

.theme-bacchus .address-cta-module h2 {
  font-size: 18px;
  color: #0f172a;
  font-weight: 600;
}

.theme-bacchus .address-info {
  background: rgba(248, 250, 252, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border, rgba(226, 232, 240, 0.5));
  padding: 12px;
  border-radius: 8px;
}

.theme-bacchus .address-info h3 {
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.theme-bacchus .address-info p {
  font-size: 14px;
  font-weight: 500;
  color: #0f172a;
}

/* Property type selector */
.theme-bacchus .property-type-selector {
  margin-top: 20px;
}

.theme-bacchus .property-type-selector h3 {
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
}

.theme-bacchus .property-type-selector select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--glass-border, rgba(226, 232, 240, 0.5));
  border-radius: 8px;
  font-size: 14px;
  background: rgba(248, 250, 252, 0.7);
  color: #0f172a;
}

.theme-bacchus .property-type-selector p {
  font-size: 12px;
  color: #64748b;
  margin-top: 6px;
  line-height: 1.4;
}

/* Button group */
.theme-bacchus .button-group {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.theme-bacchus .btn {
  padding: 14px 20px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.theme-bacchus .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Loading skeleton */
.theme-bacchus .loading-skeleton {
  background: linear-gradient(90deg, rgba(248, 250, 252, 0.7) 25%, rgba(226, 232, 240, 0.5) 50%, rgba(248, 250, 252, 0.7) 75%);
  background-size: 200% 100%;
  animation: glass-loading 1.5s infinite;
  border-radius: 4px;
}

@keyframes glass-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.theme-bacchus .loading-state {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--glass-bg-elevated, rgba(255, 255, 255, 0.85));
  backdrop-filter: blur(var(--glass-blur, 12px));
  -webkit-backdrop-filter: blur(var(--glass-blur, 12px));
  padding: 20px 16px;
  border-radius: 16px 16px 0 0;
  border-top: 1px solid var(--glass-border, rgba(226, 232, 240, 0.5));
}

/* Error message */
.theme-bacchus .error-message {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: rgba(254, 242, 242, 0.95);
  backdrop-filter: blur(var(--glass-blur, 12px));
  -webkit-backdrop-filter: blur(var(--glass-blur, 12px));
  color: #dc2626;
  padding: 16px;
  border-radius: 16px 16px 0 0;
  border-top: 1px solid rgba(220, 38, 38, 0.3);
}

/* ==============================================
   10. HOW IT WORKS
   ============================================== */

.theme-bacchus .how-it-works {
  background: var(--glass-bg, rgba(255, 255, 255, 0.7)) !important;
  backdrop-filter: blur(var(--glass-blur, 12px)) !important;
  -webkit-backdrop-filter: blur(var(--glass-blur, 12px)) !important;
  border: 1px solid var(--glass-border, rgba(226, 232, 240, 0.5)) !important;
  border-radius: 12px !important;
}

.theme-bacchus .how-it-works-toggle {
  color: #0f172a !important;
  font-weight: 600;
}

.theme-bacchus .how-it-works-steps,
.theme-bacchus .how-it-works-steps li {
  color: #475569 !important;
}

.theme-bacchus .how-it-works-chevron {
  color: var(--color-cta, #f59e0b) !important;
}

/* ==============================================
   11. TAB NAVIGATION (Report Tabs)
   ============================================== */

.theme-bacchus .tab-nav {
  display: flex;
  gap: 8px;
  padding: 16px 16px 0 16px;
  background: transparent;
  border-bottom: 2px solid rgba(203, 213, 225, 0.3);
}

.theme-bacchus .tab-button {
  flex: 1;
  padding: 12px 16px;
  background: rgba(248, 250, 252, 0.5);
  border: 1px solid var(--glass-border, rgba(226, 232, 240, 0.5));
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  font-size: 1rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.theme-bacchus .tab-button:hover {
  background: rgba(248, 250, 252, 0.8);
  color: #475569;
}

.theme-bacchus .tab-button.active {
  background: #ffffff;
  border-color: rgba(226, 232, 240, 0.8);
  color: #0f172a;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
  position: relative;
}

.theme-bacchus .tab-button.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-cta, #f59e0b);
}

.theme-bacchus .tab-panel {
  display: none;
  animation: glass-fadeIn 0.3s ease-in-out;
}

.theme-bacchus .tab-panel.active {
  display: block;
}

@keyframes glass-fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ==============================================
   12. BOTTOM NAVIGATION
   ============================================== */

.theme-bacchus .bottom-nav {
  background: var(--glass-bg-elevated, rgba(255, 255, 255, 0.85)) !important;
  backdrop-filter: blur(var(--glass-blur, 12px)) !important;
  -webkit-backdrop-filter: blur(var(--glass-blur, 12px)) !important;
  border-top: 1px solid var(--glass-border, rgba(226, 232, 240, 0.5)) !important;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05) !important;
}

.theme-bacchus .bottom-nav .nav-item {
  color: #64748b !important;
}

.theme-bacchus .bottom-nav .nav-item.active {
  color: var(--color-cta, #f59e0b) !important;
}

/* ==============================================
   13. ZONE CARDS
   ============================================== */

.theme-bacchus .area-card {
  background: var(--glass-bg, rgba(255, 255, 255, 0.7)) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border, rgba(226, 232, 240, 0.5)) !important;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1)) !important;
  color: #0f172a !important;
}

.theme-bacchus .area-card .area-name {
  color: #0f172a !important;
}

.theme-bacchus .area-card .area-count {
  color: #64748b !important;
}

.theme-bacchus .area-card.active {
  border-color: var(--color-cta, #f59e0b) !important;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2) !important;
}

.theme-bacchus .area-card.completed {
  border-color: #10b981 !important;
}

/* ==============================================
   14. REPORT ELEMENTS
   ============================================== */

.theme-bacchus .grade-display,
.theme-bacchus .zone-card-placeholder,
.theme-bacchus .zone-cards-grid > * {
  background: rgba(248, 250, 252, 0.8) !important;
  border: 1px solid var(--glass-border, rgba(226, 232, 240, 0.5)) !important;
}

.theme-bacchus .grade-letter,
.theme-bacchus .grade-description {
  color: #0f172a !important;
}

.theme-bacchus .grade-score {
  color: #64748b !important;
}

/* Gallery */
.theme-bacchus .structure-group {
  background: rgba(248, 250, 252, 0.5);
  border: 1px solid var(--glass-border, rgba(226, 232, 240, 0.5));
  border-radius: 8px;
  padding: 16px;
}

.theme-bacchus .structure-header {
  font-size: 1.125rem;
  font-weight: 600;
  color: #0f172a;
}

.theme-bacchus .feature-header {
  font-size: 0.875rem;
  font-weight: 600;
  color: #64748b;
}

.theme-bacchus .photo-item {
  border-radius: 8px;
  overflow: hidden;
  background: rgba(248, 250, 252, 0.8);
  border: 1px solid var(--glass-border, rgba(226, 232, 240, 0.5));
}

/* Risk gauge - prevent blue fills */
.theme-bacchus .risk-gauge svg circle {
  fill: none !important;
  fill-opacity: 0 !important;
}

.theme-bacchus .risk-gauge svg circle:not([stroke]) {
  display: none !important;
}

/* Feedback form */
.theme-bacchus .feedback-form,
.theme-bacchus .feedback-textarea,
.theme-bacchus .btn-voice-feedback {
  background: rgba(248, 250, 252, 0.8) !important;
  border: 1px solid var(--glass-border, rgba(226, 232, 240, 0.5)) !important;
  color: #0f172a !important;
}

.theme-bacchus .feedback-success,
.theme-bacchus .share-success {
  background: rgba(248, 250, 252, 0.8) !important;
  border: 1px solid var(--glass-border, rgba(226, 232, 240, 0.5)) !important;
  color: #0f172a !important;
}

/* ==============================================
   15. EMPTY STATES
   ============================================== */

.theme-bacchus .empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #64748b;
}

.theme-bacchus .empty-state .empty-icon,
.theme-bacchus .empty-state .empty-state-icon {
  color: #cbd5e1;
}

.theme-bacchus .empty-state .empty-title,
.theme-bacchus .empty-state .empty-state-title {
  color: #475569;
}

.theme-bacchus .empty-state .empty-message,
.theme-bacchus .empty-state .empty-state-message {
  color: #64748b;
}

/* ==============================================
   16. STATUS MESSAGES
   ============================================== */

.theme-bacchus .status-message {
  background: var(--glass-bg, rgba(255, 255, 255, 0.7)) !important;
  border: 1px solid var(--glass-border, rgba(226, 232, 240, 0.5)) !important;
  color: #0f172a !important;
}

.theme-bacchus #search-here-error {
  color: #dc2626 !important;
}

.theme-bacchus #search-here-status {
  color: var(--color-cta, #f59e0b) !important;
}

/* ==============================================
   17. RESPONSIVE
   ============================================== */

/* iPhone SE */
@media (max-width: 375px) and (max-height: 667px) {
  .theme-bacchus .address-cta-module {
    padding: 16px 12px calc(env(safe-area-inset-bottom, 12px) + 12px);
  }

  .theme-bacchus .address-cta-module h2 {
    font-size: 16px;
  }

  .theme-bacchus .header-icon-container,
  .theme-bacchus .glass-icon-container {
    width: 40px;
    height: 40px;
  }
}

/* Desktop/tablet - center CTA module */
@media (min-width: 768px) {
  .theme-bacchus .address-cta-module,
  .theme-bacchus .loading-state,
  .theme-bacchus .error-message {
    max-width: 600px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 16px;
    bottom: 24px;
  }
}
