/* DifferenZ Calculator - iOS-specific fixes */
/* This file only affects Safari/WebKit on iOS devices (iPhone/iPad) */
/* It will NOT affect Android, Desktop, or other browsers */

@supports (-webkit-touch-callout: none) {
  /* iOS Tablet and Mobile - General fixes */
  @media only screen and (max-width: 768px) {
    /* Force rounded corners on iOS */
    .dz-card {
      border-radius: 1.5rem !important;
      -webkit-border-radius: 1.5rem !important;
      overflow: visible;
    }

    .dz-building-option {
      border-radius: 1rem !important;
      -webkit-border-radius: 1rem !important;
      overflow: hidden;
    }

    .dz-cost-box {
      border-radius: 1rem !important;
      -webkit-border-radius: 1rem !important;
      overflow: hidden;
    }

    .dz-breakdown {
      border-radius: 1rem !important;
      -webkit-border-radius: 1rem !important;
      overflow: hidden;
    }

    .dz-comparison-box {
      border-radius: 1rem !important;
      -webkit-border-radius: 1rem !important;
      overflow: hidden;
    }

    .dz-savings-box {
      border-radius: 1rem !important;
      -webkit-border-radius: 1rem !important;
      overflow: hidden;
    }

    .dz-building-type-display {
      border-radius: 1rem !important;
      -webkit-border-radius: 1rem !important;
      overflow: hidden;
    }

    .dz-btn {
      border-radius: 0.75rem !important;
      -webkit-border-radius: 0.75rem !important;
    }

    /* Ensure proper spacing and appearance */
    .dz-container {
      -webkit-overflow-scrolling: touch;
      overflow-x: hidden;
    }

    /* Fix input and select appearance on iOS */
    .dz-form-input,
    .dz-form-select {
      -webkit-appearance: none;
      -moz-appearance: none;
      appearance: none;
      border-radius: 0.5rem !important;
      -webkit-border-radius: 0.5rem !important;
    }

    /* Remove iOS default input shadows and styling */
    .dz-form-input:focus,
    .dz-form-select:focus {
      outline: none;
      -webkit-tap-highlight-color: transparent;
    }

    /* Ensure smooth scrolling */
    * {
      -webkit-overflow-scrolling: touch;
    }

    /* Fix any clipping issues */
    .dz-cost-summary,
    .dz-comparison-grid,
    .dz-savings-section {
      overflow: visible;
    }

    /* Better touch targets for iOS */
    .dz-building-option,
    .dz-btn {
      -webkit-tap-highlight-color: rgba(0, 174, 237, 0.1);
    }

    /* Fix iOS Safari zoom on input focus */
    .dz-form-input,
    .dz-form-select {
      font-size: 16px !important;
    }
  }

  /* iOS Phone-specific adjustments */
  @media only screen and (max-width: 480px) {
    .dz-card {
      border-radius: 1.25rem !important;
      -webkit-border-radius: 1.25rem !important;
    }

    .dz-building-option,
    .dz-cost-box,
    .dz-breakdown,
    .dz-comparison-box,
    .dz-savings-box {
      border-radius: 0.875rem !important;
      -webkit-border-radius: 0.875rem !important;
    }

    .dz-btn {
      border-radius: 0.625rem !important;
      -webkit-border-radius: 0.625rem !important;
    }

    .dz-building-type-display {
      border-radius: 0.75rem !important;
      -webkit-border-radius: 0.75rem !important;
    }

    /* Smaller font adjustment for very small iOS screens */
    .dz-card-title {
      font-size: 1.25rem !important;
    }

    .dz-card-subtitle {
      font-size: 0.9rem !important;
      line-height: 1.4 !important;
    }
  }

  /* iOS-specific table fixes */
  @media only screen and (max-width: 768px) {
    .dz-summary-table {
      -webkit-overflow-scrolling: touch;
    }

    .dz-summary-table th,
    .dz-summary-table td {
      -webkit-font-smoothing: antialiased;
    }
  }

  /* iOS Step indicator adjustments */
  @media only screen and (max-width: 480px) {
    .dz-step-circle {
      -webkit-transform: translateZ(0);
      transform: translateZ(0);
    }

    .dz-step-indicator::before {
      -webkit-transform: translateZ(0);
      transform: translateZ(0);
    }
  }

  /* Fix for iOS button active state */
  @media only screen and (max-width: 768px) {
    .dz-btn:active {
      opacity: 0.8;
      transform: scale(0.98);
      -webkit-transform: scale(0.98);
    }

    .dz-building-option:active {
      opacity: 0.9;
      transform: scale(0.98);
      -webkit-transform: scale(0.98);
    }
  }

  /* iOS-specific form row adjustments */
  @media only screen and (max-width: 768px) {
    .dz-form-row {
      -webkit-tap-highlight-color: transparent;
    }
  }

  /* Prevent iOS Safari from adding default styles to buttons */
  @media only screen and (max-width: 768px) {
    .dz-btn,
    .dz-building-option,
    .dz-form-input,
    .dz-form-select {
      -webkit-appearance: none;
      -moz-appearance: none;
      appearance: none;
    }
  }
}

/* Additional iOS Safari-specific fixes for better rendering */
@media only screen and (max-width: 768px) and (-webkit-min-device-pixel-ratio: 2) {
  /* Retina display optimizations for iOS */
  .dz-card,
  .dz-cost-box,
  .dz-breakdown,
  .dz-btn {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}