/*
 * Precision Renewal Windows - Site Styles
 * Theme System with CSS Variables and Bootstrap Integration
 */

/* ===== CSS VARIABLE SYSTEM ===== */

/* Default Theme */
:root {
  /* Colors */
  --bg: #ffffff;
  --surface: #f8f9fa;
  --text: #212529;
  --muted: #6c757d;
  --primary: #0d6efd;
  --primary-contrast: #ffffff;
  --accent: #fd7e14;
  --success: #198754;
  --warning: #ffc107;
  --danger: #dc3545;

  /* Layout */
  --border-radius: 0.375rem;
  --border-radius-lg: 0.5rem;
  --border-radius-xl: 1rem;

  /* Shadows */
  --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  --shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 3rem;
}

/* Midnight Theme */
[data-theme="midnight"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --primary: #3b82f6;
  --primary-contrast: #ffffff;
  --accent: #f59e0b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
}

/* Emerald Theme */
[data-theme="emerald"] {
  --bg: #f0fdf4;
  --surface: #ecfdf5;
  --text: #052e16;
  --muted: #4b5563;
  --primary: #059669;
  --primary-contrast: #ffffff;
  --accent: #d97706;
  --success: #16a34a;
  --warning: #eab308;
  --danger: #dc2626;
}

/* Autumn Theme */
[data-theme="autumn"] {
  --bg: #fffbeb;
  --surface: #fef3c7;
  --text: #92400e;
  --muted: #6b7280;
  --primary: #d97706;
  --primary-contrast: #ffffff;
  --accent: #dc2626;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
}

/* Ocean Theme */
[data-theme="ocean"] {
  --bg: #f0f9ff;
  --surface: #e0f2fe;
  --text: #0c4a6e;
  --muted: #64748b;
  --primary: #0ea5e9;
  --primary-contrast: #ffffff;
  --accent: #0891b2;
  --success: #059669;
  --warning: #eab308;
  --danger: #dc2626;
}

/* ===== GLOBAL STYLES ===== */

body {
  background-color: var(--bg);
  color: var(--text);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Bootstrap Variable Overrides */
.bg-surface {
  background-color: var(--surface) !important;
  transition: background-color 0.3s ease;
}

.text-primary {
  color: var(--primary) !important;
}

.text-muted {
  color: var(--muted) !important;
}

.btn-primary {
  background-color: var(--primary);
  border-color: var(--primary);
  color: var(--primary-contrast);
}

.btn-primary:hover {
  background-color: color-mix(in srgb, var(--primary) 85%, black);
  border-color: color-mix(in srgb, var(--primary) 85%, black);
}

.btn-accent {
  background-color: var(--accent);
  border-color: var(--accent);
  color: var(--primary-contrast);
}

.btn-accent:hover {
  background-color: color-mix(in srgb, var(--accent) 85%, black);
  border-color: color-mix(in srgb, var(--accent) 85%, black);
  color: var(--primary-contrast);
}

.btn-outline-accent {
  color: var(--accent);
  border-color: var(--accent);
}

.btn-outline-accent:hover {
  background-color: var(--accent);
  border-color: var(--accent);
  color: var(--primary-contrast);
}

.bg-primary {
  background-color: var(--primary) !important;
}

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

.text-accent {
  color: var(--accent) !important;
}

/* Card Styles */
.card {
  background-color: var(--bg);
  border-color: color-mix(in srgb, var(--text) 15%, transparent);
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ===== COMPONENT STYLES ===== */

/* Navigation */
.navbar {
  background-color: var(--surface) !important;
  border-bottom: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
  transition: all 0.3s ease;
}

.navbar-brand {
  font-weight: 700 !important;
  color: var(--primary) !important;
}

.nav-link {
  color: var(--text) !important;
  font-weight: 500;
  transition: color 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary) !important;
}

/* Theme Dropdown Styling */
.dropdown-menu {
  background-color: var(--bg);
  border-color: color-mix(in srgb, var(--text) 15%, transparent);
  box-shadow: var(--shadow);
}

.dropdown-item {
  color: var(--text);
  transition: all 0.3s ease;
}

.dropdown-item:hover {
  background-color: var(--surface);
  color: var(--primary);
}

/* Hero Section */
.hero-section {
  background: linear-gradient(135deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 80%, black) 100%);
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" fill="white" opacity="0.1"><polygon points="0,0 1000,0 1000,100 0,80"/></svg>');
  background-size: cover;
}

/* Quote Form Card */
.quote-form-card {
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-theme="midnight"] .quote-form-card {
  background: rgba(30, 41, 59, 0.95);
  color: var(--text);
}

/* Trust Badges */
.trust-badge {
  padding: var(--spacing-md);
  text-align: center;
  transition: transform 0.3s ease;
}

.trust-badge:hover {
  transform: scale(1.05);
}

/* Window Style Cards */
.window-style-card {
  transition: all 0.3s ease;
  border: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
}

.window-style-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.window-style-card .card-img-top {
  transition: transform 0.3s ease;
}

.window-style-card:hover .card-img-top {
  transform: scale(1.05);
}

/* Feature Cards */
.feature-card {
  transition: all 0.3s ease;
  border: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  background-color: var(--bg) !important;
}

/* Process Steps */
.process-step {
  padding: var(--spacing-lg);
  transition: transform 0.3s ease;
}

.process-step:hover {
  transform: translateY(-3px);
}

.process-icon {
  width: 80px;
  height: 80px;
  background-color: var(--primary);
  transition: all 0.3s ease;
}

.process-icon:hover {
  background-color: var(--accent);
  transform: scale(1.1);
}

/* Before/After Gallery */
.before-after-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--border-radius-lg);
}

.before-after-card .overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  color: white;
  padding: var(--spacing-lg);
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.before-after-card:hover .overlay {
  transform: translateY(0);
}

/* Testimonial Cards */
.testimonial-card {
  background-color: var(--surface);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-xl);
  transition: all 0.3s ease;
}

.testimonial-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

/* Carousel Styling */
.carousel-control-prev,
.carousel-control-next {
  filter: invert(1);
}

[data-theme="midnight"] .carousel-control-prev,
[data-theme="midnight"] .carousel-control-next {
  filter: none;
}

/* Badge Utilities */
.badge-energy-star {
  background-color: var(--warning);
  color: black;
  font-weight: 600;
}

.badge-warranty {
  background-color: var(--success);
  color: white;
  font-weight: 600;
}

.badge-financing {
  background-color: var(--accent);
  color: white;
  font-weight: 600;
}

/* Mobile Call Bar */
.mobile-call-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--bg);
  border-top: 2px solid var(--primary);
  padding: var(--spacing-sm);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  transition: all 0.3s ease;
}

/* Cookie Notice */
.cookie-notice {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: color-mix(in srgb, var(--text) 90%, transparent);
  color: var(--bg);
  padding: var(--spacing-md);
  z-index: 1050;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.cookie-notice.show {
  transform: translateY(0);
}

/* Footer */
footer {
  background-color: #212529 !important;
  color: #f8f9fa;
}

footer .social-links a {
  transition: color 0.3s ease;
}

footer .social-links a:hover {
  color: var(--primary) !important;
}

/* Form Enhancements */
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--primary) 25%, transparent);
}

.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--primary) 25%, transparent);
}

.form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

/* Accordion Styling */
.accordion-item {
  background-color: var(--bg);
  border-color: color-mix(in srgb, var(--text) 15%, transparent);
}

.accordion-button {
  background-color: var(--surface);
  color: var(--text);
}

.accordion-button:not(.collapsed) {
  background-color: var(--primary);
  color: var(--primary-contrast);
}

.accordion-button:focus {
  box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--primary) 25%, transparent);
}

/* Table Styling */
.table {
  color: var(--text);
}

.table-striped > tbody > tr:nth-of-type(odd) > td {
  background-color: var(--surface);
}

/* Offer Card */
.offer-card {
  border-left: 4px solid var(--accent);
  transition: all 0.3s ease;
}

.offer-card:hover {
  transform: translateX(5px);
  box-shadow: var(--shadow);
}

/* Contact Option Cards */
.contact-option {
  transition: all 0.3s ease;
}

.contact-option:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

/* Financing Cards */
.financing-card {
  transition: all 0.3s ease;
}

.financing-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

/* Material Cards */
.material-card {
  transition: all 0.3s ease;
}

.material-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

/* Benefit Cards */
.benefit-card {
  transition: transform 0.3s ease;
}

.benefit-card:hover {
  transform: translateY(-3px);
}

/* Feature Highlights */
.feature-highlight {
  transition: transform 0.3s ease;
}

.feature-highlight:hover {
  transform: translateY(-3px);
}

.feature-icon {
  width: 80px;
  height: 80px;
  transition: all 0.3s ease;
}

.feature-icon:hover {
  transform: scale(1.1);
}

/* Contact Highlights */
.contact-highlight {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
  transition: all 0.3s ease;
}

.contact-highlight:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

/* Gallery Filters */
.gallery-filters .btn {
  margin: var(--spacing-xs);
  transition: all 0.3s ease;
}

.gallery-filters .btn.active {
  background-color: var(--primary);
  border-color: var(--primary);
  color: var(--primary-contrast);
}

/* Image Gallery */
.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--border-radius);
  transition: transform 0.3s ease;
}

.gallery-item:hover {
  transform: scale(1.02);
  z-index: 1;
}

.gallery-item img {
  transition: transform 0.3s ease;
}

.gallery-item:hover img {
  transform: scale(1.1);
}

/* Disclosure Box */
.disclosure-box {
  border-left: 4px solid var(--warning);
  background-color: var(--surface);
}

/* Contact Item */
.contact-item {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-md);
}

/* Stats Cards */
.stat-card {
  text-align: center;
  padding: var(--spacing-lg);
  background-color: var(--surface);
  border-radius: var(--border-radius-lg);
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

/* Team Member Cards */
.team-member {
  text-align: center;
  transition: transform 0.3s ease;
}

.team-member:hover {
  transform: translateY(-3px);
}

.team-member img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid var(--primary);
  transition: border-color 0.3s ease;
}

.team-member:hover img {
  border-color: var(--accent);
}

/* Service Area Cards */
.service-area-card {
  transition: all 0.3s ease;
  border: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
}

.service-area-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
}

/* Review Cards */
.review-card {
  transition: all 0.3s ease;
  border: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
}

.review-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
}

.review-avatar {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--primary);
}

/* Rating Stars */
.rating-stars {
  color: var(--warning);
  font-size: 1.2rem;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Mobile Optimizations */
@media (max-width: 768px) {
  .hero-section h1 {
    font-size: 2rem;
  }

  .display-4 {
    font-size: 2rem;
  }

  .display-5 {
    font-size: 1.75rem;
  }

  .process-icon,
  .feature-icon {
    width: 60px;
    height: 60px;
  }

  .stat-number {
    font-size: 2rem;
  }

  .team-member img {
    width: 120px;
    height: 120px;
  }

  .mobile-call-bar {
    padding: var(--spacing-md);
  }
}

/* Tablet Optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
  .container {
    max-width: 90%;
  }
}

/* Desktop Optimizations */
@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .navbar,
  .mobile-call-bar,
  .cookie-notice,
  footer {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }

  .card {
    border: 1px solid #ddd !important;
    box-shadow: none !important;
  }

  h1, h2, h3, h4, h5, h6 {
    color: black !important;
  }
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */

/* Focus Styles */
.btn:focus,
.form-control:focus,
.form-select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  :root {
    --bg: #ffffff;
    --text: #000000;
    --primary: #0000ff;
    --surface: #f0f0f0;
  }

  [data-theme="midnight"] {
    --bg: #000000;
    --text: #ffffff;
    --primary: #00ffff;
    --surface: #333333;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== FIX FOR BOOTSTRAP ICONS ISSUES ===== */

/* Ensure Bootstrap Icons render correctly */
[class^="bi-"], [class*=" bi-"] {
  display: inline-block;
  font-family: "bootstrap-icons" !important;
  font-style: normal;
  font-weight: normal !important;
  font-variant: normal;
  text-transform: none;
  line-height: 1;
  vertical-align: -.125em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Hide any empty or undefined icons */
i[class=""]:before,
i:not([class]):before {
  display: none !important;
}

/* Fallback for when Bootstrap Icons fails to load */
@media screen and (-webkit-min-device-pixel-ratio:0) {
  [class^="bi-"]:before, [class*=" bi-"]:before {
    font-family: "bootstrap-icons" !important;
  }
}

/* ===== UTILITY CLASSES ===== */

/* Spacing Utilities */
.p-xs { padding: var(--spacing-xs); }
.p-sm { padding: var(--spacing-sm); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }
.p-xl { padding: var(--spacing-xl); }

.m-xs { margin: var(--spacing-xs); }
.m-sm { margin: var(--spacing-sm); }
.m-md { margin: var(--spacing-md); }
.m-lg { margin: var(--spacing-lg); }
.m-xl { margin: var(--spacing-xl); }

/* Border Radius Utilities */
.rounded-xs { border-radius: var(--spacing-xs); }
.rounded-sm { border-radius: var(--spacing-sm); }
.rounded-md { border-radius: var(--border-radius); }
.rounded-lg { border-radius: var(--border-radius-lg); }
.rounded-xl { border-radius: var(--border-radius-xl); }

/* Shadow Utilities */
.shadow-xs { box-shadow: var(--shadow-sm); }
.shadow-sm { box-shadow: var(--shadow); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* Animation Classes */
.fade-in {
  animation: fadeIn 0.6s ease-in-out;
}

.slide-up {
  animation: slideUp 0.6s ease-out;
}

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

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