/**
 * ECODRIVO COMPONENT SYSTEM
 * Reusable components: Buttons, Cards, Modals, Forms, Calculator, Comparison Matrix, and Timeline.
 */

/* ============================================================================
   1. BUTTONS
   ============================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .btn {
    white-space: normal;
    text-align: center;
    word-break: break-word;
    max-width: 100%;
  }
  .btn-lg {
    padding: 12px 20px !important;
    font-size: 0.95rem !important;
  }
  .btn-sm {
    padding: 7px 12px !important;
    font-size: 0.8rem !important;
  }
}

.btn-primary {
  background-color: var(--color-brand-green);
  color: var(--color-brand-white);
}

.btn-primary:hover {
  background-color: var(--color-brand-green-hover);
  color: var(--color-brand-white);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-secondary {
  background-color: var(--color-brand-black);
  color: var(--color-brand-white);
}

.btn-secondary:hover {
  background-color: #2b3035;
  color: var(--color-brand-white);
}

.btn-outline {
  background-color: transparent;
  border-color: var(--color-border);
  color: var(--color-brand-black);
}

.btn-outline:hover {
  border-color: var(--color-brand-black);
  background-color: var(--color-brand-black);
  color: var(--color-brand-white);
}

.btn-outline-white {
  background-color: transparent;
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--color-brand-white);
}

.btn-outline-white:hover {
  border-color: var(--color-brand-white);
  background-color: var(--color-brand-white);
  color: var(--color-brand-black);
}

.btn-whatsapp {
  background-color: #25D366;
  color: #ffffff;
}

.btn-whatsapp:hover {
  background-color: #1eb855;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 1.05rem;
}

.btn-block {
  width: 100%;
}

/* ============================================================================
   2. HERO SECTION
   ============================================================================ */
.hero-section {
  position: relative;
  background-color: var(--color-brand-black);
  color: var(--color-brand-white);
  padding: 80px 0 100px;
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 48px;
}

.hero-content {
  z-index: 2;
}

.hero-title {
  color: var(--color-brand-white);
  margin-bottom: 20px;
}

.hero-lead {
  font-size: 1.25rem;
  color: #cbd5e1;
  margin-bottom: 32px;
  max-width: 540px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.hero-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.highlight-item strong {
  display: block;
  font-size: 1.75rem;
  color: var(--color-brand-green);
  font-weight: 800;
}

.highlight-item span {
  font-size: 0.85rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero-visual {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: visible;
}

.hero-scooter-img {
  width: 100%;
  max-width: 580px;
  height: auto;
  filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.7));
  transform: scale(1.05);
  transition: transform var(--transition-smooth);
}

.hero-visual:hover .hero-scooter-img {
  transform: scale(1.08) translateY(-4px);
}

.floating-pill {
  position: absolute;
  background: rgba(26, 29, 32, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  color: #ffffff;
}

.pill-top-right {
  top: 10%;
  right: -5%;
}

.pill-bottom-left {
  bottom: 8%;
  left: -5%;
}

@media (max-width: 992px) {
  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 36px;
  }
  .hero-lead {
    margin-left: auto;
    margin-right: auto;
  }
  .hero-actions {
    justify-content: center;
  }
  .hero-highlights {
    justify-content: center;
  }
  .pill-top-right, .pill-bottom-left {
    position: static;
    margin: 8px auto;
  }
}

@media (max-width: 640px) {
  .hero-section {
    padding: 48px 0 60px;
  }
  .hero-title {
    font-size: clamp(2rem, 7vw, 2.75rem);
    margin-bottom: 16px;
  }
  .hero-lead {
    font-size: 1rem;
    margin-bottom: 24px;
  }
  .hero-actions {
    flex-direction: column;
    width: 100%;
    gap: 12px;
    margin-bottom: 28px;
  }
  .hero-actions .btn {
    width: 100%;
  }
  .hero-highlights {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding-top: 20px;
    width: 100%;
  }
  .highlight-item strong {
    font-size: 1.25rem;
  }
  .highlight-item span {
    font-size: 0.7rem;
  }
  .hero-scooter-img {
    transform: none !important;
    max-width: 100%;
  }
}

@media (max-width: 380px) {
  .hero-highlights {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

/* ============================================================================
   3. PRODUCT CARDS & SHOWCASE
   ============================================================================ */
.product-card {
  background-color: var(--color-brand-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: #cbd5e1;
}

.product-media {
  position: relative;
  background: radial-gradient(circle at center, #f8fafc 0%, #edf2f7 100%);
  padding: 32px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
}

.product-media img {
  max-height: 230px;
  width: auto;
  object-fit: contain;
  transition: transform var(--transition-normal);
}

.product-card:hover .product-media img {
  transform: scale(1.05);
}

.product-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  background-color: var(--color-brand-black);
  color: var(--color-brand-white);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.product-badge.badge-green {
  background-color: var(--color-brand-green);
}

.product-body {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-title {
  font-size: 1.4rem;
  margin-bottom: 6px;
}

.product-tagline {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.product-specs-chip-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 16px 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 20px;
}

.spec-chip {
  display: flex;
  flex-direction: column;
}

.spec-chip-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.spec-chip-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-brand-black);
}

.product-pricing {
  margin-bottom: 20px;
}

.price-sublabel {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

.price-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--color-brand-black);
}

.price-condition {
  font-size: 0.8rem;
  color: #dc2626;
  font-weight: 500;
}

.product-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
}

.product-actions .btn {
  flex: 1;
}

@media (max-width: 640px) {
  .product-actions {
    flex-direction: column;
    gap: 8px;
  }
  .product-actions .btn {
    width: 100%;
  }
}

/* ============================================================================
   4. INTERACTIVE FUEL SAVINGS CALCULATOR
   ============================================================================ */
.calculator-card {
  background-color: var(--color-brand-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-md);
}

@media (max-width: 640px) {
  .calculator-card {
    padding: 20px 16px;
    border-radius: var(--radius-md);
  }
}

.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
}

.calc-inputs-col h3, .calc-results-col h3 {
  margin-bottom: 24px;
}

.slider-group {
  margin-bottom: 24px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.slider-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-main);
}

.slider-display-badge {
  background-color: var(--color-brand-subtle);
  border: 1px solid var(--color-border);
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  color: var(--color-brand-green-hover);
  font-size: 0.95rem;
}

.calc-slider {
  width: 100%;
  height: 6px;
  border-radius: 4px;
  background: #e2e8f0;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.calc-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-brand-green);
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.calc-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-brand-green);
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Results Section */
.calc-results-box {
  background: linear-gradient(145deg, #111315 0%, #1e2226 100%);
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
}

.result-hero {
  margin-bottom: 28px;
}

.result-hero-label {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #94a3b8;
}

.result-hero-amount {
  font-size: clamp(2.5rem, 4vw, 3.5rem);
  font-weight: 800;
  color: var(--color-brand-green);
  line-height: 1.1;
  margin: 6px 0;
}

.result-hero-sub {
  font-size: 0.85rem;
  color: #94a3b8;
}

.comparison-pills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.pill-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 16px;
  border-radius: var(--radius-sm);
}

.pill-card-title {
  font-size: 0.8rem;
  color: #94a3b8;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.pill-card-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
}

.calc-disclaimer-note {
  font-size: 0.775rem;
  color: #64748b;
  line-height: 1.5;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 16px;
  margin-top: 20px;
}

@media (max-width: 900px) {
  .calc-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .calc-results-box {
    padding: 20px 16px;
  }
  .comparison-pills-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* ============================================================================
   5. COMPARISON MATRIX
   ============================================================================ */
.comparison-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background-color: var(--color-brand-white);
  box-shadow: var(--shadow-sm);
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.comparison-table th, .comparison-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}

.comparison-table th {
  background-color: var(--color-brand-subtle);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-brand-black);
}

.comparison-table td {
  font-size: 0.925rem;
  color: var(--color-text-main);
}

.comparison-table tr:last-child td {
  border-bottom: none;
}

.comparison-table tr:hover td {
  background-color: #fafbfc;
}

/* ============================================================================
   6. FORMS & INPUT CONTROLS
   ============================================================================ */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-main);
  margin-bottom: 6px;
}

.form-label .req {
  color: #dc2626;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: #ffffff;
  color: var(--color-text-main);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

@media (max-width: 640px) {
  .form-control {
    font-size: 16px; /* Prevents auto-zoom on iOS */
    padding: 10px 14px;
  }
}

.form-control:focus {
  outline: none;
  border-color: var(--color-brand-green);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

textarea.form-control {
  min-height: 110px;
  resize: vertical;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.file-dropzone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  background-color: var(--color-brand-offwhite);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.file-dropzone:hover {
  border-color: var(--color-brand-green);
  background-color: var(--color-brand-green-soft);
}

/* ============================================================================
   7. BADGES & STATUS PILLS
   ============================================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-green { background: #dcfce7; color: #166534; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-purple { background: #f3e8ff; color: #6b21a8; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gray { background: #f1f5f9; color: #475569; }

/* ============================================================================
   8. SERVICE TRACKING TIMELINE
   ============================================================================ */
.timeline {
  position: relative;
  padding: 24px 0 24px 32px;
  margin-left: 12px;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 11px;
  width: 2px;
  background-color: var(--color-border);
}

.timeline-item {
  position: relative;
  margin-bottom: 28px;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -28px;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: #ffffff;
  border: 3px solid var(--color-brand-green);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.timeline-content {
  background-color: var(--color-brand-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  flex-wrap: wrap;
  gap: 8px;
}

.timeline-status {
  font-weight: 700;
  color: var(--color-brand-black);
}

.timeline-time {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* ============================================================================
   9. MODALS & TOAST NOTIFICATIONS
   ============================================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-content {
  background-color: var(--color-brand-white);
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  padding: 32px;
  box-shadow: var(--shadow-lg);
  position: relative;
  transform: translateY(20px);
  transition: transform var(--transition-normal);
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

@media (max-width: 640px) {
  .modal-overlay {
    padding: 12px;
  }
  .modal-content {
    padding: 24px 16px;
    border-radius: var(--radius-md);
  }
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text-muted);
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: var(--color-brand-black);
  color: #ffffff;
  padding: 16px 24px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 2100;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateY(100px);
  opacity: 0;
  transition: all var(--transition-normal);
}

.toast.active {
  transform: translateY(0);
  opacity: 1;
}

.toast-success {
  border-left: 4px solid var(--color-brand-green);
}

.toast-error {
  border-left: 4px solid #ef4444;
}
