/* Mobile-First Responsive Design */

/* Touch-Friendly Interactions */
@media (max-width: 768px) {
    /* Increase touch targets */
    button,
    .option-card,
    .checkbox-item,
    .radio-item {
        min-height: 48px;
        touch-action: manipulation;
    }
    
    /* Improve form inputs for mobile */
    input,
    select,
    textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 1rem;
        border-radius: 8px;
    }
    
    /* Mobile-optimized sliders */
    input[type="range"] {
        height: 8px;
        margin: 1rem 0;
    }
    
    input[type="range"]::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
        margin-top: -8px;
    }
    
    /* Mobile navigation improvements */
    .cta-button {
        padding: 1.25rem 2rem;
        font-size: 1.1rem;
        width: 100%;
        max-width: 300px;
    }
    
    .continue-btn {
        padding: 1.25rem;
        font-size: 1.1rem;
        margin-top: 2rem;
    }
}

/* Small Mobile Devices (iPhone SE, etc.) */
@media (max-width: 480px) {
    .content-container {
        padding: 1rem;
    }
    
    .hero-section h1 {
        font-size: 1.8rem;
        line-height: 1.3;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .realtor-photo {
        width: 90px;
        height: 90px;
    }
    
    .questionnaire-container {
        padding: 1.5rem;
        margin: 0.5rem;
    }
    
    .question-content h2 {
        font-size: 1.4rem;
        line-height: 1.3;
    }
    
    .option-card {
        padding: 1.25rem;
    }
    
    .option-card h3 {
        font-size: 1.1rem;
    }
    
    .option-icon {
        font-size: 2rem;
    }
    
    .checkbox-item,
    .radio-item {
        padding: 0.875rem;
        font-size: 0.95rem;
    }
    
    .modal-content {
        margin: 0.5rem;
        border-radius: 8px;
    }
    
    .modal-header,
    .modal-body {
        padding: 1rem;
    }
}

/* Landscape Mobile Optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .property-background {
        padding: 1rem 0;
    }
    
    .content-container {
        max-width: 500px;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .realtor-photo {
        width: 80px;
        height: 80px;
        margin-bottom: 1rem;
    }
    
    .questionnaire-page {
        padding: 1rem;
    }
    
    .questionnaire-container {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Touch Gesture Enhancements */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .option-card:hover,
    .checkbox-item:hover,
    .radio-item:hover,
    .document-item:hover,
    .match-card:hover {
        transform: none;
    }
    
    /* Add active states for touch */
    .option-card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    .continue-btn:active,
    .cta-button:active,
    .review-doc-btn:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    /* Improve checkbox/radio touch targets */
    .checkbox-item,
    .radio-item {
        padding: 1rem;
        margin: 0.25rem 0;
    }
    
    .checkbox-item input,
    .radio-item input {
        width: 24px;
        height: 24px;
    }
}

/* iOS Safari Specific Fixes */
@supports (-webkit-touch-callout: none) {
    /* Fix iOS viewport issues */
    body {
        -webkit-text-size-adjust: 100%;
    }
    
    /* Fix iOS input zoom */
    input,
    select,
    textarea {
        font-size: 16px;
    }
    
    /* Fix iOS button styling */
    button,
    input[type="submit"],
    input[type="button"] {
        -webkit-appearance: none;
        border-radius: 8px;
    }
    
    /* Fix iOS range slider */
    input[type="range"] {
        -webkit-appearance: none;
    }
    
    input[type="range"]::-webkit-slider-thumb {
        -webkit-appearance: none;
    }
}

/* Android Chrome Specific Fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    /* Fix Android input styling */
    input[type="checkbox"],
    input[type="radio"] {
        zoom: 1.2;
    }
    
    /* Fix Android select styling */
    select {
        background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23666' d='m2 0 2 3H0l2-3z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 0.75rem center;
        background-size: 0.75rem;
        padding-right: 2.5rem;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }
}

/* High DPI Display Optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .realtor-photo {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    .property-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Dark Mode Support (System Preference) */
@media (prefers-color-scheme: dark) {
    /* This can be implemented later if needed */
    /* For now, we'll stick with light theme as per PRD */
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .spinner {
        animation: none;
        border-top-color: #3498db;
    }
}

/* Print Styles */
@media print {
    .dashboard-page,
    .questionnaire-page {
        background: white !important;
    }
    
    .modal,
    .loading-overlay,
    button {
        display: none !important;
    }
    
    .summary-section {
        background: white !important;
        border: 1px solid #ccc !important;
    }
}
