/*
 * Medicare Provider Search - Responsive Styles
 * Version: 1.0.0
 * Purpose: Mobile-first responsive design for all device sizes
 * Breakpoints: 320px, 480px, 768px, 1024px, 1200px+
 */

/* ==========================================================================
   Mobile First Base (320px+)
   ========================================================================== */

/* Already handled in main.css mobile-first approach */

/* ==========================================================================
   Small Mobile (320px - 479px)
   ========================================================================== */

@media screen and (max-width: 479px) {
    .medicare-provider-search {
        padding: 8px;
    }
    
    .search-header {
        margin-bottom: 15px;
        padding-bottom: 15px;
        text-align: left;
    }
    
    .search-title {
        font-size: 1.3rem;
        line-height: 1.2;
    }
    
    .search-subtitle {
        font-size: 0.9rem;
    }
    
    /* Compact tab navigation */
    .tab-navigation {
        margin-bottom: 15px;
    }
    
    .tab-button {
        padding: 8px 10px;
        font-size: 0.8rem;
        font-weight: 500;
    }
    
    /* Streamlined form sections */
    .search-form {
        gap: 20px;
    }
    
    .search-section {
        padding: 12px;
        margin-bottom: 15px;
        border-left-width: 3px;
    }
    
    .section-title {
        font-size: 1rem;
        margin-bottom: 12px;
    }
    
    .section-title::before {
        width: 3px;
        height: 14px;
        margin-right: 6px;
    }
    
    /* Compact form elements */
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-label {
        font-size: 0.85rem;
        margin-bottom: 4px;
        font-weight: 500;
    }
    
    .form-input, .form-select {
        padding: 8px 10px;
        font-size: 16px; /* Prevent iOS zoom */
        border-width: 1px;
    }
    
    .form-help {
        font-size: 0.75rem;
        margin-top: 2px;
    }
    
    /* Checkbox adjustments */
    .checkbox-label {
        margin-bottom: 8px;
        font-size: 0.8rem;
    }
    
    .checkbox-label input[type="checkbox"] {
        width: 14px;
        height: 14px;
        margin-right: 6px;
    }
    
    /* Button adjustments */
    .form-actions {
        gap: 8px;
        padding-top: 12px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 0.8rem;
        min-width: auto;
        font-weight: 500;
    }
    
    /* Results adjustments */
    .search-results {
        margin-top: 20px;
    }
    
    .results-header {
        padding: 12px;
    }
    
    .results-title {
        font-size: 1.1rem;
    }
    
    .results-count {
        font-size: 0.8rem;
    }
    
    .results-list {
        max-height: 250px;
    }
    
    .result-item {
        padding: 12px;
    }
    
    .result-name {
        font-size: 1rem;
    }
    
    .result-type {
        font-size: 0.7rem;
        padding: 2px 6px;
    }
    
    .result-details {
        grid-template-columns: 1fr;
        gap: 6px;
        margin-bottom: 10px;
    }
    
    .result-detail {
        font-size: 0.75rem;
    }
    
    .result-contact {
        padding: 8px;
        font-size: 0.8rem;
    }
}

/* ==========================================================================
   Large Mobile / Small Tablet (480px - 767px)
   ========================================================================== */

@media screen and (min-width: 480px) and (max-width: 767px) {
    .medicare-provider-search {
        padding: 12px;
    }
    
    .search-title {
        font-size: 1.6rem;
    }
    
    .search-subtitle {
        font-size: 1rem;
    }
    
    .tab-button {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .search-section {
        padding: 16px;
    }
    
    .section-title {
        font-size: 1.1rem;
    }
    
    .form-input, .form-select {
        padding: 10px 14px;
        font-size: 16px; /* Prevent iOS zoom */
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    /* Two-column layout for some form elements */
    .form-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
    
    .form-row .form-group {
        margin-bottom: 0;
    }
    
    /* Results improvements */
    .results-list {
        max-height: 350px;
    }
    
    .result-details {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
}

/* ==========================================================================
   Tablet Portrait (768px - 1023px)
   ========================================================================== */

@media screen and (min-width: 768px) and (max-width: 1023px) {
    .medicare-provider-search {
        padding: 20px;
    }
    
    .search-title {
        font-size: 1.8rem;
    }
    
    .tab-button {
        padding: 12px 20px;
        font-size: 1rem;
    }
    
    .search-section {
        padding: 20px;
    }
    
    /* Enhanced form layouts */
    .form-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        align-items: end;
    }
    
    .form-row-three {
        display: grid;
        grid-template-columns: 2fr 1fr 1fr;
        gap: 20px;
        align-items: end;
    }
    
    .form-row .form-group,
    .form-row-three .form-group {
        margin-bottom: 0;
    }
    
    /* Better button layout */
    .form-actions {
        justify-content: flex-start;
        gap: 20px;
    }
    
    .btn {
        min-width: 140px;
    }
    
    /* Enhanced results */
    .results-list {
        max-height: 500px;
    }
    
    .result-item {
        padding: 20px;
    }
    
    .result-header {
        flex-direction: row;
        align-items: center;
    }
    
    .result-details {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 20px;
    }
}

/* ==========================================================================
   Tablet Landscape / Small Desktop (1024px - 1199px)
   ========================================================================== */

@media screen and (min-width: 1024px) and (max-width: 1199px) {
    .medicare-provider-search {
        max-width: 1000px;
        padding: 25px;
    }
    
    /* Side-by-side form sections for larger screens */
    .search-form {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 30px;
        align-items: start;
    }
    
    .search-section {
        margin-bottom: 0;
    }
    
    /* Location section spans full width */
    .search-section:first-child {
        grid-column: 1 / -1;
    }
    
    /* Form actions span full width */
    .form-actions {
        grid-column: 1 / -1;
        justify-content: center;
        gap: 30px;
    }
    
    .btn {
        min-width: 160px;
        padding: 14px 28px;
        font-size: 1.1rem;
    }
    
    /* Enhanced checkbox layouts */
    .checkbox-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
    
    .checkbox-group legend {
        grid-column: 1 / -1;
    }
    
    /* Results enhancements */
    .results-list {
        max-height: 600px;
    }
    
    .result-details {
        grid-template-columns: repeat(4, 1fr);
        gap: 25px;
    }
}

/* ==========================================================================
   Large Desktop (1200px+)
   ========================================================================== */

@media screen and (min-width: 1200px) {
    .medicare-provider-search {
        max-width: 1200px;
        padding: 30px;
    }
    
    .search-header {
        margin-bottom: 40px;
        padding-bottom: 25px;
    }
    
    .search-title {
        font-size: 2.2rem;
    }
    
    .search-subtitle {
        font-size: 1.2rem;
    }
    
    /* Three-column form layout for complex sections */
    .search-form {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 35px;
    }
    
    /* Location section spans full width */
    .search-section:first-child {
        grid-column: 1 / -1;
    }
    
    .search-section {
        padding: 25px;
    }
    
    .section-title {
        font-size: 1.3rem;
        margin-bottom: 25px;
    }
    
    /* Enhanced form elements */
    .form-input, .form-select {
        padding: 14px 18px;
        font-size: 1rem;
    }
    
    /* Form actions improvements */
    .form-actions {
        grid-column: 1 / -1;
        justify-content: center;
        padding-top: 30px;
        gap: 40px;
    }
    
    .btn {
        min-width: 180px;
        padding: 16px 32px;
        font-size: 1.1rem;
    }
    
    /* Premium results layout */
    .search-results {
        margin-top: 40px;
    }
    
    .results-header {
        padding: 25px;
    }
    
    .results-title {
        font-size: 1.4rem;
    }
    
    .results-count {
        font-size: 1rem;
    }
    
    .result-item {
        padding: 25px;
    }
    
    .result-name {
        font-size: 1.2rem;
    }
    
    .result-details {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 30px;
    }
    
    .result-contact {
        padding: 15px;
        font-size: 1rem;
    }
}

/* ==========================================================================
   Ultra Wide Screens (1400px+)
   ========================================================================== */

@media screen and (min-width: 1400px) {
    .medicare-provider-search {
        max-width: 1400px;
    }
    
    /* Four-column layout for ultra-wide */
    .search-form {
        grid-template-columns: repeat(4, 1fr);
        gap: 40px;
    }
    
    .search-section:first-child {
        grid-column: 1 / -1;
    }
    
    /* Enhanced spacing */
    .search-section {
        padding: 30px;
    }
    
    .section-title {
        font-size: 1.4rem;
    }
    
    .result-details {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* ==========================================================================
   Orientation-Specific Styles
   ========================================================================== */

/* Landscape orientation optimizations */
@media screen and (orientation: landscape) and (max-height: 600px) {
    .search-header {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }
    
    .search-title {
        font-size: 1.4rem;
    }
    
    .search-subtitle {
        font-size: 0.9rem;
    }
    
    .tab-navigation {
        margin-bottom: 20px;
    }
    
    .search-section {
        padding: 15px;
    }
    
    .section-title {
        font-size: 1rem;
        margin-bottom: 15px;
    }
    
    .results-list {
        max-height: 200px;
    }
}

/* ==========================================================================
   Container Queries (Future-proofing)
   ========================================================================== */

/* When container queries are fully supported */
@supports (container-type: inline-size) {
    .medicare-provider-search {
        container-type: inline-size;
    }
    
    @container (max-width: 600px) {
        .search-form {
            grid-template-columns: 1fr;
        }
        
        .form-row,
        .form-row-three {
            grid-template-columns: 1fr;
        }
    }
    
    @container (min-width: 800px) {
        .search-form {
            grid-template-columns: 1fr 1fr;
        }
    }
    
    @container (min-width: 1200px) {
        .search-form {
            grid-template-columns: 1fr 1fr 1fr;
        }
    }
}

/* ==========================================================================
   Dynamic Viewport Units (Modern browsers)
   ========================================================================== */

@supports (height: 100dvh) {
    .medicare-provider-search {
        min-height: 100dvh;
    }
}

@supports (height: 100svh) {
    .loading {
        height: 100svh;
    }
}