/*
  TABLE OF CONTENTS - CSS STYLES
  ==============================
  1. CSS Custom Properties (Variables)
  2. Base & Reset Styles
  3. Modal & Container Styles
  4. Progress Bar Styles
  5. Form Layout & Typography
  6. Option Selection Styles
  7. Input Field Styles
  8. Address Suggestion Styles
  9. Property Details Display
  10. Error & Success Messages
  11. Navigation Button Styles
  12. Utility Classes
  13. API Response Display
  14. Media Queries & Responsive Design
  15. Animations & Keyframes
*/

/* =====================================
   1. CSS CUSTOM PROPERTIES (VARIABLES)
   ===================================== */
:root {
  /* Primary Color Palette */
  --primary: #FF1493;
  --accent: #FF1493;
  --secondary: #14ff80;
  --tertiary: #1493FF;
  
  /* Text Colors */
  --text: #111;
  --text-muted: #666;
  
  /* Background Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  
  /* Border & UI Colors */
  --border: #d9dbe1;
  
  /* Status Colors */
  --error: #dc3545;
  --error-light: #f8d7da;
  --success: #28a745;
  --success-bg: #d4edda;
  --warning: #856404;
  --warning-bg: #fff3cd;
  --info-bg: #eef6ff;
  
  /* Spacing Scale */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 20px;
  --spacing-xl: 24px;
  
  /* Border Radius Scale */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  
  /* Transitions & Effects */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --focus-ring: 0 0 0 3px rgba(255,20,147,0.35);
  
  /* Animation Durations */
  --animation-duration-short: 300;
  --animation-duration-medium: 900;
  
  /* API Configuration */
  --api-timeout: 10000;
}

/* =====================================
   2. BASE & RESET STYLES
   ===================================== */
* { 
  box-sizing: border-box; 
}

html, body { 
  height: 100%; 
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
}

/* =====================================
   3. MODAL & CONTAINER STYLES
   ===================================== */
.modal-overlay {
  display: flex;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  animation: fadeIn var(--transition-normal);
}

.modal-container {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  width: 96%;
  max-width: 920px;
  max-height: 92vh;
  overflow-y: auto;
  padding: var(--spacing-xl);
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.close-modal {
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  font-size: 24px;
  cursor: pointer;
  background: none;
  border: none;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
}

.close-modal:focus-visible { 
  outline: none; 
  box-shadow: var(--focus-ring); 
}

.close-modal:hover { 
  background: #f1f1f1; 
}

/* =====================================
   4. PROGRESS BAR STYLES
   ===================================== */
.progress-container { 
  margin-bottom: 24px; 
}

.progress-steps { 
  display: none; 
}   /* Hide dots (non-linear form) */

.step-counter { 
  display: none; 
}     /* Hide counter */

.progress-bar {
  width: 100%;
  height: 8px;
  background: #f0f2f6;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width var(--transition-normal);
}

/* =====================================
   5. FORM LAYOUT & TYPOGRAPHY
   ===================================== */
.step-info { 
  text-align: center; 
  margin-bottom: 20px; 
}

.step-title { 
  font-size: 1.5rem; 
  font-weight: 700; 
  color: var(--text); 
  margin: 0; 
}

.context-summary {
  background: var(--info-bg);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-lg);
  border-left: 4px solid var(--tertiary);
  display: none;
}

.context-summary.show { 
  display: block; 
  animation: slideIn var(--transition-normal); 
}

.context-summary h4 { 
  margin: 0 0 8px 0; 
  color: var(--text); 
  font-size: 0.9rem; 
  font-weight: 600; 
}

.context-list { 
  list-style: none; 
  padding: 0; 
  margin: 0; 
  display: flex; 
  flex-wrap: wrap; 
  gap: 8px; 
}

.context-item { 
  background: white; 
  padding: 4px 8px; 
  border-radius: 4px; 
  font-size: 0.85rem; 
  border: 1px solid #dee2e6; 
}

form { 
  margin: 0; 
}

.question { 
  display: none; 
  min-height: 260px; 
}

.question.active { 
  display: block; 
  animation: fadeIn var(--transition-fast); 
}

fieldset { 
  border: 0; 
  padding: 0; 
  margin: 0 0 8px; 
}

legend { 
  font-size: 1.15rem; 
  font-weight: 700; 
  margin-bottom: 8px; 
  color: var(--text); 
  line-height: 1.4; 
}

.help-text { 
  font-size: 0.95rem; 
  color: var(--text-muted); 
  margin-bottom: 12px; 
}

.required-indicator { 
  color: var(--error); 
  margin-left: 4px; 
}

.field-note { 
  font-size: 0.85rem; 
  color: var(--text-muted); 
  font-style: italic; 
  margin-bottom: 16px; 
}

/* =====================================
   6. OPTION SELECTION STYLES
   ===================================== */
.options { 
  display: grid; 
  gap: 12px; 
}

.option {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 60px;
}

/* Contact step: 3 columns on wide screens */
#contact #delivery-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

#contact #delivery-options .option { 
  height: 100%; 
}

@media (max-width: 640px) {
  #contact #delivery-options { 
    grid-template-columns: 1fr; 
  }
}

.option:hover { 
  background: #fff6fb; 
  border-color: var(--primary); 
  transform: translateY(-1px); 
}

.option.selected { 
  background: #ffe6f3; 
  border-color: var(--primary); 
  box-shadow: 0 2px 8px rgba(255, 20, 147, 0.15); 
  transform: translateY(-1px); 
}

.option input {
  width: 24px;
  height: 24px;
  margin: 0;
  accent-color: var(--primary);
  pointer-events: none;
  flex-shrink: 0;
}

.option input[type="radio"],
.option input[type="checkbox"] { 
  outline: none; 
  box-shadow: none; 
}

.option input[type="radio"]:focus,
.option input[type="checkbox"]:focus { 
  outline: none; 
  box-shadow: none; 
}

.option input:focus-visible { 
  outline: none; 
  box-shadow: none; 
}

.option label { 
  cursor: pointer; 
  font-weight: 600; 
  flex: 1; 
  line-height: 1.4; 
}

.option .desc { 
  display: block; 
  color: var(--text-muted); 
  font-weight: 400; 
  margin-top: 4px; 
  font-size: 0.9rem; 
}

.option .label-content { 
  flex: 1; 
}

.option.confirming {
  background: var(--secondary) !important;
  border-color: var(--secondary) !important;
  box-shadow: 0 0 0 2px var(--secondary) !important;
  transform: scale(1.02);
}

/* =====================================
   7. INPUT FIELD STYLES
   ===================================== */
.form-row { 
  margin: 0 0 20px; 
}

.form-row label { 
  display: block; 
  font-weight: 600; 
  margin-bottom: 8px; 
  color: var(--text); 
}

.input-container { 
  position: relative; 
}

.text-input, .number-input, .select-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 16px;
  transition: all var(--transition-fast);
  background: var(--bg-primary);
  color: var(--text);
  line-height: 1.4;
}

.text-input::placeholder { 
  color: #9aa1ad; 
}

.text-input:focus, .number-input:focus, .select-input:focus { 
  outline: none; 
  border-color: var(--primary); 
  box-shadow: var(--focus-ring); 
}

.text-input.error, .number-input.error { 
  border-color: var(--error); 
  background: var(--error-light); 
}

.hint { 
  font-size: 13px; 
  color: var(--text-muted); 
  margin-top: 8px; 
  line-height: 1.4; 
}

/* =====================================
   8. ADDRESS SUGGESTION STYLES
   ===================================== */
.address-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 2px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  display: none;
}

.address-suggestion { 
  padding: 12px 16px; 
  cursor: pointer; 
  border-bottom: 1px solid #f1f1f1; 
  transition: background var(--transition-fast); 
}

.address-suggestion:hover { 
  background: var(--bg-secondary); 
}

.address-suggestion:last-child { 
  border-bottom: none; 
}

.loading-spinner {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: none;
}

@keyframes spin { 
  0% { transform: translateY(-50%) rotate(0deg); } 
  100% { transform: translateY(-50%) rotate(360deg); } 
}

/* =====================================
   9. PROPERTY DETAILS DISPLAY
   ===================================== */
.property-details {
  background: var(--bg-secondary);
  padding: var(--spacing-lg);
  border-radius: var(--radius-lg);
  margin: var(--spacing-md) 0;
  border-left: 4px solid var(--tertiary);
}

.property-grid { 
  display: grid; 
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); 
  gap: var(--spacing-md); 
  margin-top: var(--spacing-md); 
}

.property-item { 
  background: var(--bg-primary); 
  padding: var(--spacing-md); 
  border-radius: var(--radius-md); 
  border: 1px solid var(--border); 
}

.property-label { 
  font-size: 11px; 
  color: var(--text-muted); 
  letter-spacing: .4px; 
  text-transform: uppercase; 
  margin-bottom: 4px; 
}

.property-value { 
  font-size: 15px; 
  font-weight: 700; 
  color: var(--text); 
}

/* =====================================
   10. ERROR & SUCCESS MESSAGES
   ===================================== */
.inline-error {
  color: var(--error);
  font-size: 14px;
  margin-top: 6px;
  display: none;
  padding: 8px 12px;
  background: var(--error-light);
  border-radius: var(--radius-sm);
  border: 1px solid #f5c6cb;
  animation: slideIn var(--transition-fast);
}

.inline-error.show { 
  display: block; 
}

.success-message {
  color: var(--success);
  background: var(--success-bg);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-top: 12px;
  display: none;
  border: 1px solid #c3e6cb;
}

.loading-message {
  color: var(--warning);
  background: var(--warning-bg);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-top: 12px;
  display: none;
  border: 1px solid #ffeaa7;
  position: relative;
}

/* =====================================
   11. NAVIGATION BUTTON STYLES
   ===================================== */
.nav-buttons {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  gap: 8px;
  z-index: 100;
}

.btn {
  width: 44px;
  height: 44px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  transition: all var(--transition-fast);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  color: var(--text-muted);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.btn:focus-visible { 
  outline: none; 
  box-shadow: var(--focus-ring); 
}

.btn-back:hover, .btn-next:hover {
  background: var(--bg-secondary);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn:disabled {
  opacity: .4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05) !important;
  color: #ccc !important;
}

.cta-btn {
  display: inline-block;
  padding: 12px 16px;
  border: 2px solid var(--primary);
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast);
  margin-top: 8px;
}

.cta-btn:hover { 
  filter: brightness(1.06); 
  transform: translateY(-1px); 
  box-shadow: 0 4px 12px rgba(255, 20, 147, 0.25); 
}

.cta-btn:focus-visible { 
  outline: none; 
  box-shadow: var(--focus-ring); 
}

.cta-btn:disabled { 
  opacity: .6; 
  cursor: not-allowed; 
  transform: none; 
  box-shadow: none; 
}

/* =====================================
   12. UTILITY CLASSES
   ===================================== */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =====================================
   13. API RESPONSE DISPLAY
   ===================================== */
.response-container {
  margin-top: 40px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #dee2e6;
}

.response-container h3 { 
  margin-top: 0; 
  color: #495057; 
}

.response-container pre {
  background: #ffffff;
  padding: 15px;
  border-radius: 4px;
  border: 1px solid #e9ecef;
  overflow-x: auto;
  white-space: pre-wrap;
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
  margin: 0;
}

/* =====================================
   14. MEDIA QUERIES & RESPONSIVE DESIGN
   ===================================== */
@media (max-width: 768px) {
  .modal-container {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    padding: 20px;
  }
  
  .nav-buttons { 
    bottom: 16px; 
    right: 16px; 
    gap: 6px; 
  }
  
  .btn { 
    width: 40px; 
    height: 40px; 
    font-size: 16px; 
  }
  
  .options { 
    gap: 10px; 
  }
  
  .option { 
    padding: 14px; 
    min-height: 50px; 
  }
}

/* =====================================
   15. ANIMATIONS & KEYFRAMES
   ===================================== */
@keyframes fadeIn { 
  from { 
    opacity: 0; 
    transform: translateY(12px); 
  } 
  to { 
    opacity: 1; 
    transform: translateY(0); 
  } 
}

@keyframes slideIn { 
  from { 
    opacity: 0; 
    transform: translateY(-8px); 
  } 
  to { 
    opacity: 1; 
    transform: translateY(0); 
  } 
}