/* ==========================================================================
   Samsun Gomme Rezervuar - Custom Styles
   Supplements Tailwind CSS with animations, transitions, and components
   that utility classes alone cannot express.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */
:root {
  /* Brand palette */
  --color-primary:      #AEEBFF;
  --color-primary-dark:  #7DD3F0;
  --color-secondary:     #2F2F2F;
  --color-accent:        #00C2A8;
  --color-accent-dark:   #00A08A;

  /* Neutral helpers */
  --color-white:         #FFFFFF;
  --color-light-bg:      #F0FAFF;
  --color-border:        #E2E8F0;
  --color-text:          #333333;
  --color-text-muted:    #6B7280;

  /* Shared timing */
  --transition-fast:     150ms ease;
  --transition-base:     300ms ease;
  --transition-slow:     500ms ease;
}

/* --------------------------------------------------------------------------
   2. Global / Base
   -------------------------------------------------------------------------- */
/* scroll-behavior: smooth JS tarafinda kontrol ediliyor (main.js scrollTo).
   CSS'te birakilirsa mobilde her layout shift animasyonlu scroll tetikler. */

body {
  font-family: 'Inter', sans-serif;
  color: var(--color-text);
}

/* --------------------------------------------------------------------------
   3. Sticky Navigation Transition
   -------------------------------------------------------------------------- */
.nav {
  transition:
    height var(--transition-base),
    padding var(--transition-base),
    box-shadow var(--transition-base);
}

.nav--scrolled {
  height: 64px;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* --------------------------------------------------------------------------
   4. Hero Slider Animations
   -------------------------------------------------------------------------- */

/* Fade-up entrance for hero text / CTAs */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero__content--animate {
  animation: fadeUp 0.6s var(--transition-base) both;
}

/* Cross-fade between slides */
@keyframes crossfade {
  0%   { opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ===================================================================
   Hero Slider — Yatay Kayma (Slide) Gecisi

   Nasil calisir:
     - Varsayilan: translateX(100%) → sag tarafta gizli bekler
     - --active:   translateX(0)   → gorunur, 500ms kayarak gelir
     - --exit:     translateX(-100%) → sola kayarak cikar
     - overflow:hidden ile konteyner disindaki kisimlar kirilir

   Neden layout shift olmaz:
     - transform layout'u ETKILEMEZ (GPU compositing)
     - Grid stacking ile konteyner yuksekligi tum slide'larin max'i (sabit)
     - JS inline style YAZMAZ, sadece class toggle

   =================================================================== */
.hero-slides {
  display: grid;
  overflow: hidden;
  overflow-anchor: none;
  position: relative;
}

.hero-slide {
  grid-area: 1 / 1;
  transform: translateX(100%);
  visibility: hidden;
  z-index: 1;
  pointer-events: none;
  overflow-anchor: none;
}

.hero-slide--active {
  transform: translateX(0);
  visibility: visible;
  z-index: 2;
  pointer-events: auto;
  transition: transform 500ms cubic-bezier(.4, 0, .2, 1), visibility 0s 0s;
}

.hero-slide--exit {
  transform: translateX(-100%);
  visibility: visible;
  z-index: 2;
  pointer-events: none;
  transition: transform 500ms cubic-bezier(.4, 0, .2, 1), visibility 0s 500ms;
}

@media (prefers-reduced-motion: reduce) {
  .hero-slide--active,
  .hero-slide--exit {
    transition: none;
  }
}

/* Slide indicator dots */
.hero-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-border);
  border: none;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.hero-dot--active {
  background: var(--color-accent);
  transform: scale(1.3);
}

/* --------------------------------------------------------------------------
   5. FAQ Accordion
   -------------------------------------------------------------------------- */
.faq-item .faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-base);
}

.faq-item.active .faq-answer {
  max-height: 600px;
}

.faq-item.active {
  border-color: rgba(0, 194, 168, 0.4);
  box-shadow: 0 4px 6px -1px rgba(0, 194, 168, 0.05);
}

/* --------------------------------------------------------------------------
   6. Service Card Hover
   -------------------------------------------------------------------------- */
.service-card {
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base);
}

.service-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

/* --------------------------------------------------------------------------
   7. Brand Logo Grayscale -> Color
   -------------------------------------------------------------------------- */
.brand-logo {
  filter: grayscale(100%);
  opacity: 0.6;
  transition: filter var(--transition-base), opacity var(--transition-base);
}

.brand-logo:hover {
  filter: grayscale(0%);
  opacity: 1;
}

/* --------------------------------------------------------------------------
   8. Counter Animation Helpers
   -------------------------------------------------------------------------- */
.counter {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   9. Section Alternating Backgrounds
   -------------------------------------------------------------------------- */
.section-light {
  background-color: var(--color-light-bg);
}


/* --------------------------------------------------------------------------
   10b. Back to Top Button
   -------------------------------------------------------------------------- */
.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 50;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-secondary);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base), transform var(--transition-fast);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.back-to-top:hover {
  transform: scale(1.1);
  background: var(--color-accent);
}

.back-to-top--visible {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 768px) {
  .back-to-top {
    bottom: 5.5rem;
  }
}

/* --------------------------------------------------------------------------
   11. Mobile Sticky Bottom Bar — Floating Pill
   -------------------------------------------------------------------------- */
.mobile-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  padding: 0 12px 12px;
  display: none;
  pointer-events: none;
  /* safe area for notched phones */
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.mbb-inner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0;
  max-width: 360px;
  margin: 0 auto;
  background: rgba(47, 47, 47, 0.92);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-radius: 50px;
  padding: 6px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

/* Shared button styles */
.mbb-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 44px;
  text-decoration: none;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
  transition: all 200ms ease;
  position: relative;
  overflow: hidden;
}

.mbb-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 200ms ease;
}

.mbb-btn:active {
  transform: scale(0.96);
}

/* Icon container */
.mbb-btn__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mbb-btn__text {
  white-space: nowrap;
  line-height: 1;
}

/* --- Phone button --- */
.mbb-btn--phone {
  background: var(--color-accent);
  color: #fff;
}

.mbb-btn--phone::before {
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 1;
}

.mbb-btn--phone:hover,
.mbb-btn--phone:focus-visible {
  background: var(--color-accent-dark);
  box-shadow: 0 0 20px rgba(0, 194, 168, 0.4);
}

.mbb-btn--phone .mbb-btn__icon {
  background: rgba(255, 255, 255, 0.2);
}

/* --- WhatsApp button --- */
.mbb-btn--whatsapp {
  background: rgba(37, 211, 102, 0.15);
  color: #25D366;
}

.mbb-btn--whatsapp .mbb-btn__icon {
  background: rgba(37, 211, 102, 0.15);
  color: #25D366;
}

/* Divider */
.mbb-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .mobile-bottom-bar {
    display: block;
  }

  body {
    padding-bottom: 80px;
  }
}

/* Larger phones — slightly bigger bar */
@media (min-width: 400px) and (max-width: 768px) {
  .mbb-inner {
    max-width: 400px;
  }

  .mbb-btn {
    font-size: 14px;
    padding: 13px 18px;
  }
}

/* --------------------------------------------------------------------------
   12. Custom Scrollbar
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-light-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--color-primary-dark);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent);
}

/* Firefox */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary-dark) var(--color-light-bg);
}

/* --------------------------------------------------------------------------
   13. Loading Spinner (form submission)
   -------------------------------------------------------------------------- */
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn--loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.btn--loading .spinner {
  margin-left: 0.5rem;
}

/* --------------------------------------------------------------------------
   14. Toast Notifications
   -------------------------------------------------------------------------- */
.toast {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  min-width: 280px;
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  color: var(--color-white);
  font-size: 0.875rem;
  line-height: 1.4;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transform: translateX(120%);
  transition: transform var(--transition-base);
}

.toast--visible {
  transform: translateX(0);
}

.toast--success {
  background: var(--color-accent);
}

.toast--error {
  background: #E53E3E;
}

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

/* --------------------------------------------------------------------------
   16. Print Styles
   -------------------------------------------------------------------------- */
@media print {
  /* Hide non-essential UI */
  .nav,
  .whatsapp-float,
  .back-to-top,
  .mobile-bottom-bar,
  .toast,
  footer {
    display: none !important;
  }

  /* Reset backgrounds for ink savings */
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 12pt;
  }

  .section-light {
    background: none !important;
  }

  /* Show link URLs */
  a[href]::after {
    content: ' (' attr(href) ')';
    font-size: 0.8em;
    color: #555;
  }

  /* Avoid page breaks inside cards */
  .service-card,
  .faq__item {
    break-inside: avoid;
  }
}
