/* ==========================================================================
   AVTOSERVIS KLEMEN LAH - CUSTOM CSS
   Industrial, clean, precise, trustworthy automotive aesthetic.
   ========================================================================== */

/* 1. Root Custom Properties */
:root {
  /* Color Palette */
  --graphite: #181B1E;
  --off-white: #F4F3EF;
  --steel: #687078;
  --navy: #172A3A;
  --orange: #E9672B;
  --muted-blue: #356785;
  --light-grey: #D9DEE1;
  --olive-grey: #414844;

  /* Alpha Variants */
  --orange-10: rgba(233, 103, 43, 0.1);
  --orange-20: rgba(233, 103, 43, 0.2);
  --navy-90: rgba(23, 42, 58, 0.9);

  /* Typography */
  --font-heading: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Transitions */
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 150ms var(--ease-standard);
  --transition-normal: 250ms var(--ease-standard);
  --transition-slow: 400ms var(--ease-standard);

  /* Spacing */
  --spacing-unit: 0.25rem;
}

/* 2. Alpine.js FOUC Prevention */
[x-cloak] {
  display: none !important;
}

/* 3. Base Typography */
body {
  font-family: var(--font-body);
  color: var(--graphite);
  background-color: var(--off-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, .font-heading {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--graphite);
}

/* 4. Scroll Reveal Animations */
.reveal {
  opacity: 0;
  transform: translateY(1.5rem);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-1.5rem);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.reveal-left.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(1.5rem);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.reveal-right.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.reveal-scale.revealed {
  opacity: 1;
  transform: scale(1);
}

.stagger-1 { transition-delay: 100ms; }
.stagger-2 { transition-delay: 200ms; }
.stagger-3 { transition-delay: 300ms; }
.stagger-4 { transition-delay: 400ms; }
.stagger-5 { transition-delay: 500ms; }

/* 5. Navigation Styles */
.main-nav {
  background-color: transparent;
  transition: background-color var(--transition-normal), padding var(--transition-normal), box-shadow var(--transition-normal);
  padding-block: 1.5rem;
}

.main-nav.scrolled {
  background-color: rgba(244, 243, 239, 0.95);
  backdrop-filter: blur(8px);
  padding-block: 1rem;
  box-shadow: 0 4px 20px rgba(24, 27, 30, 0.05);
}

/* 6. Hero Section */
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(24, 27, 30, 0.9) 0%, rgba(24, 27, 30, 0.4) 40%, transparent 100%);
}

.hero-title {
  font-size: clamp(2.5rem, 5vw + 1rem, 5rem);
  line-height: 1.1;
}

@keyframes bounceSubtle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(0.5rem); }
}

.scroll-indicator {
  animation: bounceSubtle 2s infinite ease-in-out;
}

/* 7. Emergency Bar */
.emergency-bar {
  background-color: var(--orange);
  color: white;
  padding: 0.5rem 1rem;
  font-weight: 600;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: 0.02em;
}

@keyframes pulsePhone {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
  100% { transform: scale(1); opacity: 1; }
}

.emergency-bar .phone-icon {
  animation: pulsePhone 2s infinite;
}

/* 8. Industrial Texture */
.texture-grain {
  position: relative;
}

.texture-grain::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.03;
  pointer-events: none;
  z-index: 10;
  /* SVG Noise */
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* 9. Service Cards */
.service-card {
  background-color: white;
  border: 1px solid var(--light-grey);
  border-radius: 0.5rem;
  padding: 2rem;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.service-card:hover {
  transform: translateY(-0.25rem);
  box-shadow: 0 12px 24px rgba(24, 27, 30, 0.06);
  border-color: var(--orange);
}

.service-icon {
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--orange-10);
  color: var(--orange);
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
}

/* 10. Quick Action Cards */
.action-card {
  background-color: white;
  border: 1px solid var(--light-grey);
  border-left: 4px solid transparent;
  padding: 1.5rem;
  border-radius: 0.5rem;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
}

.action-card:hover, .action-card:focus-within {
  border-left-color: var(--orange);
  box-shadow: 0 8px 16px rgba(24, 27, 30, 0.04);
}

.action-card:active {
  transform: scale(0.98);
}

/* 11. Multi-Step Form */
.form-input, .form-select, .form-textarea {
  width: 100%;
  background-color: transparent;
  border: none;
  border-bottom: 2px solid var(--light-grey);
  padding: 0.75rem 0;
  color: var(--graphite);
  font-family: var(--font-body);
  transition: border-color var(--transition-fast);
  border-radius: 0;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-bottom-color: var(--orange);
}

.form-input.error, .form-select.error, .form-textarea.error {
  border-bottom-color: #EF4444;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--steel);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.step-indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  position: relative;
}

.connector {
  flex-grow: 1;
  height: 2px;
  background-color: var(--light-grey);
  margin: 0 1rem;
  position: relative;
}

.step-indicator .step {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background-color: var(--light-grey);
  color: var(--steel);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all var(--transition-normal);
  z-index: 2;
}

.step-indicator .step.active {
  background-color: var(--orange);
  color: white;
  box-shadow: 0 0 0 4px var(--orange-20);
}

.step-indicator .step.completed {
  background-color: var(--navy);
  color: white;
}

/* 12. Roadside Assistance Section */
.roadside-section {
  background: linear-gradient(135deg, var(--navy) 0%, var(--graphite) 100%);
  color: white;
}

.phone-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background-color: var(--orange);
  color: white;
  padding: 1rem 2rem;
  border-radius: 0.5rem;
  font-weight: 700;
  font-size: 1.25rem;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.phone-cta:hover {
  background-color: #D65A22;
  transform: translateY(-2px);
}

.roadside-step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  position: relative;
}

.roadside-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 3rem;
  bottom: -1.5rem;
  left: 1.25rem;
  width: 2px;
  background-color: var(--navy-90);
}

.roadside-step-number {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background-color: var(--navy-90);
  border: 1px solid var(--steel);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
}

/* 13. Tyre Section */
.tyre-campaign-banner {
  background-color: white;
  border: 1px solid var(--light-grey);
  border-radius: 0.5rem;
  position: relative;
  overflow: hidden;
}

.tyre-campaign-banner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--orange) 0%, #FBBF24 100%);
}

/* 14. Process Steps (How It Works) */
.process-timeline {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

@media (min-width: 768px) {
  .process-timeline {
    flex-direction: row;
    align-items: flex-start;
  }
}

.process-step {
  flex: 1;
  position: relative;
  text-align: center;
}

@media (min-width: 768px) {
  .process-step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 2rem;
    left: calc(50% + 2rem);
    right: calc(-50% + 2rem);
    height: 2px;
    background-color: var(--light-grey);
  }
}

.process-step-circle {
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1.5rem;
  border-radius: 50%;
  background-color: white;
  border: 2px solid var(--light-grey);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--steel);
  transition: all var(--transition-normal);
}

.process-step:hover .process-step-circle,
.process-step.active .process-step-circle {
  border-color: var(--orange);
  color: var(--orange);
  box-shadow: 0 0 0 4px var(--orange-10);
}

/* 15. FAQ Accordion */
.faq-item {
  border-bottom: 1px solid var(--light-grey);
}

.faq-question {
  width: 100%;
  background: none;
  border: none;
  padding: 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--graphite);
  cursor: pointer;
}

.faq-chevron {
  transition: transform var(--transition-normal);
  color: var(--orange);
}

.faq-item.open .faq-chevron {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-normal);
}

.faq-item.open .faq-answer {
  max-height: 20rem; /* Should be enough for average answer */
}

.faq-answer-inner {
  padding-bottom: 1.5rem;
  color: var(--steel);
}

/* 16. Mobile Action Bar */
.mobile-action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 0.75rem 1rem;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
  background: var(--graphite);
  display: flex;
  gap: 0.5rem;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.15);
}

@media (min-width: 1024px) {
  .mobile-action-bar {
    display: none;
  }
}

.mobile-action-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  color: white;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.5rem;
  border-radius: 0.375rem;
  text-decoration: none;
  transition: background-color var(--transition-fast);
}

.mobile-action-btn:active {
  background-color: var(--olive-grey);
}

.mobile-action-btn.primary {
  background-color: var(--orange);
}

.mobile-action-btn.primary:active {
  background-color: #D65A22;
}

/* 17. Presentation Mode */
.presentation-callout {
  display: none;
  position: absolute;
  top: -0.75rem;
  right: -0.75rem;
  width: 1.5rem;
  height: 1.5rem;
  background-color: var(--orange);
  color: white;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  z-index: 40;
  box-shadow: 0 2px 8px rgba(233, 103, 43, 0.4);
  cursor: help;
}

.presentation-mode .presentation-callout {
  display: flex;
  animation: pulseCallout 2s infinite;
}

@keyframes pulseCallout {
  0% { box-shadow: 0 0 0 0 rgba(233, 103, 43, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(233, 103, 43, 0); }
  100% { box-shadow: 0 0 0 0 rgba(233, 103, 43, 0); }
}

.callout-text {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 0.5rem;
  background-color: var(--navy);
  color: white;
  padding: 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 400;
  width: max-content;
  max-width: 240px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-fast), visibility var(--transition-fast);
  pointer-events: none;
}

.presentation-callout:hover .callout-text {
  opacity: 1;
  visibility: visible;
}

/* 18. Modal Styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(24, 27, 30, 0.75);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-content {
  background-color: white;
  border-radius: 0.75rem;
  width: 100%;
  max-width: 32rem;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  animation: modalEnter var(--transition-normal);
}

@keyframes modalEnter {
  from {
    opacity: 0;
    transform: translateY(2rem) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 19. Map Section */
.map-placeholder {
  background-color: var(--light-grey);
  border: 2px dashed var(--steel);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--steel);
  font-weight: 600;
  font-size: 1.25rem;
  aspect-ratio: 4/3;
  width: 100%;
}

@media (min-width: 768px) {
  .map-placeholder {
    aspect-ratio: 16/9;
  }
}

/* 20. Hover Utilities */
.hover-lift {
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.link-underline {
  position: relative;
  text-decoration: none;
}

.link-underline::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 2px;
  bottom: -2px;
  left: 0;
  background-color: currentColor;
  transform: scaleX(0);
  transform-origin: bottom right;
  transition: transform var(--transition-normal);
}

.link-underline:hover::after {
  transform: scaleX(1);
  transform-origin: bottom left;
}

/* 21. Responsive Utilities */
.section-padding {
  padding-top: 4rem;
  padding-bottom: 4rem;
}

@media (min-width: 768px) {
  .section-padding {
    padding-top: 6rem;
    padding-bottom: 6rem;
  }
}

@media (min-width: 1024px) {
  .section-padding {
    padding-top: 8rem;
    padding-bottom: 8rem;
  }
}

/* 22. Print Styles */
@media print {
  .main-nav,
  .mobile-action-bar,
  .modal-overlay,
  .emergency-bar,
  footer {
    display: none !important;
  }

  body {
    background-color: white;
    color: black;
  }

  * {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }
}

/* 23. Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .reveal,
  .reveal-left,
  .reveal-right,
  .reveal-scale {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* 24. Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--off-white);
}

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

::-webkit-scrollbar-thumb:hover {
  background: var(--olive-grey);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--steel) var(--off-white);
}

/* 25. Focus Visible */
*:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}
