/**
 * KS Roof Master - Component Styles
 * Reusable UI components for modular CSS architecture
 */

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  border-radius: var(--radius);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s, box-shadow 0.2s;
  text-align: center;
  border: none;
}
.btn:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary { background: var(--secondary); color: var(--secondary-fg); }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(245, 180, 0, 0.4); }
.btn-outline { background: transparent; border: 2px solid rgba(255,255,255,0.3); color: var(--primary-fg); }
.btn-outline:hover { background: rgba(255,255,255,0.1); }
.btn-white { background: var(--background); color: var(--primary); font-weight: 700; }
.btn-white:hover { box-shadow: var(--shadow-md); }
.btn-cta-red { background: var(--secondary); color: var(--secondary-fg); }
.btn-cta-outline { background: transparent; border: 2px solid rgba(255,255,255,0.3); color: var(--primary-fg); }
.btn-cta-outline:hover { background: rgba(255,255,255,0.1); }

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 180, 0, 0.5); }
  50% { box-shadow: 0 0 0 12px rgba(245, 180, 0, 0); }
}
.btn-pulse { animation: pulseGlow 2s infinite; }

/* ============================================
   FORMS
   ============================================ */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--foreground); margin-bottom: 0.25rem; }
.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
  font-size: 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(179, 1, 4, 0.1); }
.form-input::placeholder { color: #aaa; }
.form-input.error { border-color: #dc2626; }
.form-submit {
  width: 100%;
  padding: 0.875rem;
  background: var(--secondary);
  color: var(--secondary-fg);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.2s;
  border: none;
}
.form-submit:hover { opacity: 0.9; }
.form-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.form-error { color: #dc2626; font-size: 0.75rem; margin-top: 0.25rem; display: none; }
.form-input.error + .form-error { display: block; }

/* ============================================
   HERO
   ============================================ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
}
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(20,20,20,0.92) 0%, rgba(20,20,20,0.75) 50%, rgba(20,20,20,0.45) 100%);
}
.hero-inner {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  max-width: var(--container);
  margin: 0 auto;
  padding: 3rem 1rem;
}
.hero-content { color: var(--primary-fg); }
.hero-content h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1rem;
}
.hero-content h1 .highlight { color: var(--secondary); }
.hero-content .subtitle { font-size: 1.125rem; opacity: 0.85; margin-bottom: 1.5rem; }
.hero-bullets { margin-bottom: 1.5rem; }
.hero-bullets li { display: flex; align-items: center; gap: 0.75rem; font-size: 1rem; margin-bottom: 0.75rem; }
.hero-bullets li svg { color: var(--secondary); }
.hero-btns { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 0.75rem; opacity: 0.8; }
.hero-badge { background: rgba(255,255,255,0.1); padding: 0.375rem 0.875rem; border-radius: 50px; font-size: 0.8125rem; }
.hero-form-card {
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-xl);
}
.hero-form-card h2 { font-size: 1.375rem; font-weight: 700; color: var(--foreground); margin-bottom: 0.25rem; }
.hero-form-card .form-desc { font-size: 0.8125rem; color: var(--muted-fg); margin-bottom: 1.25rem; }

@media (max-width: 991px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero { min-height: auto; padding-top: 1rem; padding-bottom: 2rem; }
}

/* ============================================
   PROBLEMS SECTION
   ============================================ */
.problems-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 3rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}
.problem-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.25rem 1.5rem;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
}
.problem-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.problem-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: rgba(179,1,4,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--primary);
  font-size: 1.125rem;
}
.problem-card span { font-family: var(--font-heading); font-weight: 600; font-size: 0.9375rem; color: var(--foreground); }

@media (max-width: 767px) { .problems-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 479px) { .problems-grid { grid-template-columns: 1fr; } }

/* ============================================
   TRUST & COUNTERS
   ============================================ */
.counters-section { background: var(--primary); padding: 3.5rem 1rem; }
.counters-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  max-width: var(--container);
  margin: 0 auto;
  text-align: center;
}
.counter-item .number {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  color: var(--secondary);
}
.counter-item .label { font-size: 0.9375rem; color: var(--primary-fg); opacity: 0.9; margin-top: 0.25rem; font-weight: 500; }

@media (max-width: 767px) { .counters-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; } }

.trust-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.5rem;
  margin-top: 3rem;
}
.trust-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.5rem;
  background: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s, transform 0.3s;
}
.trust-card:hover { box-shadow: var(--shadow-md); transform: translateY(-4px); }
.trust-icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: rgba(179, 1, 4, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  color: var(--primary);
  font-size: 1.375rem;
}
.trust-card h3 { font-size: 0.9375rem; font-weight: 600; color: var(--foreground); margin-bottom: 0.5rem; }
.trust-card p { font-size: 0.8125rem; color: var(--muted-fg); }

@media (max-width: 991px) { .trust-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 639px) { .trust-grid { grid-template-columns: repeat(2, 1fr); } }

/* ============================================
   SERVICES
   ============================================ */
.services-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-top: 3rem;
}
.service-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  text-align: left;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
}
.service-card:hover { border-color: rgba(179,1,4,0.3); box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.service-icon {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius);
  background: rgba(179, 1, 4, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  color: var(--primary);
  font-size: 1.25rem;
  transition: background 0.3s, color 0.3s;
}
.service-card:hover .service-icon { background: var(--primary); color: var(--primary-fg); }
.service-card h3 { font-size: 1.0625rem; font-weight: 600; color: var(--foreground); margin-bottom: 0.5rem; }
.service-card p { font-size: 0.8125rem; color: var(--muted-fg); margin-bottom: 1rem; }
.service-card .learn-more { font-size: 0.8125rem; font-weight: 600; color: var(--primary); }
.service-card .learn-more:hover { text-decoration: underline; }

@media (max-width: 991px) { .services-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 767px) { .services-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 479px) { .services-grid { grid-template-columns: 1fr; } }

/* ============================================
   FAQ
   ============================================ */
.faq-list { max-width: 700px; margin: 3rem auto 0; }
.faq-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl); margin-bottom: 0.75rem; overflow: hidden; }
.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--foreground);
  text-align: left;
  border: none;
  background: none;
}
.faq-question svg { transition: transform 0.3s; color: var(--muted-fg); font-size: 0.75rem; }
.faq-item.open .faq-question svg { transform: rotate(180deg); }
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 1.5rem;
  color: var(--muted-fg);
  font-size: 0.875rem;
  line-height: 1.7;
}
.faq-item.open .faq-answer { max-height: 200px; padding: 0 1.5rem 1.25rem; }

/* ============================================
   STICKY CTAs
   ============================================ */
.sticky-call {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  z-index: 999;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-fg);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: var(--shadow-lg);
  animation: pulseGlow 2s infinite;
}
.sticky-book {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--secondary);
  color: var(--secondary-fg);
  padding: 0.75rem 1.25rem;
  border-radius: 50px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.8125rem;
  box-shadow: var(--shadow-lg);
  transition: opacity 0.2s;
}
.sticky-book:hover { opacity: 0.9; }
.sticky-book .label { display: inline; }
.sticky-whatsapp {
  position: fixed;
  bottom: 5rem;
  right: 1rem;
  z-index: 999;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: #25D366;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.375rem;
  box-shadow: var(--shadow-lg);
  transition: transform 0.2s;
}
.sticky-whatsapp:hover { transform: scale(1.1); }

@media (max-width: 767px) {
  .sticky-call { display: flex; }
  .sticky-book .label { display: none; }
  .sticky-whatsapp { bottom: 5rem; }
}

/* ============================================
   EXIT INTENT POPUP
   ============================================ */
.exit-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.exit-overlay.show { display: flex; }
.exit-popup {
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  max-width: 480px;
  width: 100%;
  position: relative;
  text-align: center;
  box-shadow: var(--shadow-xl);
  animation: fadeInUp 0.3s ease-out;
}
.exit-popup .close-popup {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  font-size: 1.25rem;
  color: var(--muted-fg);
  cursor: pointer;
  border: none;
}
.exit-popup .popup-icon { font-size: 3rem; color: var(--secondary); margin-bottom: 1rem; }
.exit-popup h3 { font-size: 1.375rem; font-weight: 800; color: var(--foreground); margin-bottom: 0.5rem; }
.exit-popup p { font-size: 0.9375rem; color: var(--muted-fg); margin-bottom: 1.5rem; }
.exit-popup .btn { width: 100%; }
.exit-popup .no-thanks { display: block; margin-top: 0.75rem; font-size: 0.8125rem; color: var(--muted-fg); cursor: pointer; background: none; border: none; font-family: var(--font-body); }

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInLeft { from { opacity: 0; transform: translateX(-30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeInRight { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.animate-on-scroll.visible { opacity: 1; transform: translateY(0); }
.animate-on-scroll.fade-left { transform: translateX(-30px); }
.animate-on-scroll.fade-left.visible { transform: translateX(0); }
.animate-on-scroll.fade-right { transform: translateX(30px); }
.animate-on-scroll.fade-right.visible { transform: translateX(0); }
.animate-on-scroll.scale-in { transform: scale(0.9); }
.animate-on-scroll.scale-in.visible { transform: scale(1); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .animate-on-scroll { opacity: 1; transform: none; }
}

/* Print styles */
@media print {
  .call-bar, .site-header, .sticky-call, .sticky-book, .sticky-whatsapp, .exit-overlay { display: none !important; }
  .hero { min-height: auto; }
  .hero-overlay { background: none; }
  .hero-content { color: var(--foreground); }
}
