/* === RESPONSIVE SEARCH CONTAINER === */
.search-container {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    overflow: hidden;
    /* Responsive height - adjusts based on content */
    min-height: 500px;
    height: auto;
    max-height: 90vh;
}

/* Mobile first approach */
@media (max-width: 768px) {
    .search-container {
        padding: var(--spacing-sm);
        border-radius: var(--radius-md);
        min-height: auto;
        max-height: none;
        margin: 0 -8px;
        /* Remove side padding on very small screens */
        border-radius: 0;
    }
}

@media (min-width: 769px) {
    .search-container {
        height: 75vh;
        /* Fixed height on desktop */
    }
}

/* === RESPONSIVE SEARCH BOX === */
.search-box {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: var(--gray-100);
    border-radius: var(--radius-md);
    border: 1px dashed var(--gray-300);
}

/* Mobile - single column */
@media (max-width: 480px) {
    .search-box {
        grid-template-columns: 1fr;
        padding: var(--spacing-sm);
        gap: var(--spacing-sm);
    }
}

/* Tablet - 2 columns */
@media (min-width: 481px) and (max-width: 768px) {
    .search-box {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }
}

/* Small desktop - 3 columns */
@media (min-width: 769px) and (max-width: 1024px) {
    .search-box {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Large desktop - 4 columns */
@media (min-width: 1025px) {
    .search-box {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* === RESPONSIVE FORM CONTROLS === */
.form-control,
.form-select {
    padding: 10px 12px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    transition: all var(--transition-fast);
    background: white;
    width: 100%;
    box-sizing: border-box;
    /* Include padding in width */
}

@media (max-width: 480px) {

    .form-control,
    .form-select {
        font-size: 14px;
        /* Slightly larger for touch */
        padding: 12px 14px;
    }
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.08);
}

.form-control::placeholder {
    color: var(--gray-400);
    font-size: 12.5px;
}

/* === RESPONSIVE BUTTON === */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    width: 100%;
    /* Full width on mobile */
    margin-top: var(--spacing-xs);
}

@media (min-width: 481px) {
    .btn {
        width: auto;
        /* Auto width on larger screens */
        margin-top: 0;
    }
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* === RESPONSIVE SEARCH RESULTS LAYOUT === */
.search-results {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    overflow: hidden;
    min-height: 300px;
    /* Minimum height for results area */
}

.results-layout {
    display: flex;
    gap: var(--spacing-md);
    flex: 1;
    min-height: 300px;
    overflow: hidden;
}

/* Mobile - vertical stack */
@media (max-width: 768px) {
    .results-layout {
        flex-direction: column;
        height: auto;
        min-height: 500px;
        gap: var(--spacing-sm);
    }
}

/* Desktop - side by side */
@media (min-width: 769px) {
    .results-layout {
        flex-direction: row;
        height: calc(60vh - var(--spacing-md));
    }
}

/* === RESPONSIVE PROVIDERS LIST === */
.results-list {
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Mobile - full width */
@media (max-width: 768px) {
    .results-list {
        flex: 0 0 250px;
        /* Fixed height on mobile */
        max-height: 250px;
    }
}

/* Desktop - fixed width sidebar */
@media (min-width: 769px) {
    .results-list {
        flex: 0 0 40%;
        max-width: 40%;
    }
}

/* Extra large screens - limit max width */
@media (min-width: 1200px) {
    .results-list {
        flex: 0 0 35%;
        max-width: 400px;
        /* Don't let it get too wide */
    }
}

.results-header {
    padding: var(--spacing-sm);
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    color: white;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    flex-shrink: 0;
    /* Prevent header from shrinking */
}

@media (max-width: 480px) {
    .results-header {
        font-size: 12px;
        padding: 8px 10px;
    }
}

.results-count {
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 500;
}

.results-scroll {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-sm);
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling on iOS */
}

@media (max-width: 480px) {
    .results-scroll {
        padding: 8px;
    }
}

.provider-item {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: var(--gray-100);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    word-break: break-word;
    /* Prevent text overflow */
}

@media (max-width: 480px) {
    .provider-item {
        padding: 8px 10px;
        margin-bottom: 6px;
    }
}

.provider-item:hover {
    background: white;
    border-color: var(--primary-light);
    transform: translateX(-3px);
    box-shadow: var(--shadow-sm);
}

.provider-item.selected {
    background: white;
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.provider-name {
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 4px;
    font-size: 13px;
}

@media (max-width: 480px) {
    .provider-name {
        font-size: 12.5px;
    }
}

.provider-address {
    color: var(--gray-600);
    font-size: 11.5px;
    margin-bottom: 8px;
    line-height: 1.4;
    max-height: 2.8em;
    /* Limit to 2 lines */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    /* -webkit-line-clamp: 2; */
    -webkit-box-orient: vertical;
}

.phones-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

@media (max-width: 480px) {
    .phones-container {
        gap: 4px;
    }
}

.phone-badge {
    background: white;
    color: var(--primary);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    text-decoration: none;
    transition: all var(--transition-fast);
    border: 1px solid var(--primary-light);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
    /* Keep phone numbers on one line */
}

.phone-badge:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* === RESPONSIVE DETAILS PANEL === */
.details-panel {
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Mobile - full width */
@media (max-width: 768px) {
    .details-panel {
        flex: 1;
        min-height: 300px;
        max-height: 50vh;
    }
}

/* Desktop - remaining width */
@media (min-width: 769px) {
    .details-panel {
        flex: 1;
        min-width: 60%;
        /* Ensure minimum width */
    }
}

.details-content {
    flex: 1;
    overflow-y: auto;
    /* padding: var(--spacing-md); */
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling on iOS */
}

@media (max-width: 480px) {
    .details-content {
        padding: var(--spacing-sm);
    }
}

/* === RESPONSIVE MAP CONTAINER === */
.map-container {
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: var(--spacing-md);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    position: relative;
    padding-bottom: 33.25%;
    /* 16:9 aspect ratio for responsive map */
    /* height: 0; */
}

.map-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

@media (max-width: 768px) {
    .map-container {
        padding-bottom: 75%;
        /* 4:3 aspect ratio on mobile */
        margin-bottom: var(--spacing-sm);
    }
}

/* === RESPONSIVE SERVICES LIST === */
.services-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-x: hidden;
}

.service-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
    transition: all var(--transition-fast);
    flex-wrap: wrap;
    /* Allow wrapping on small screens */
}

@media (max-width: 480px) {
    .service-item {
        padding: 8px 10px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

.service-item:hover {
    background: white;
    border-color: var(--primary-light);
    transform: translateX(-3px);
}

.service-name {
    font-weight: 600;
    color: var(--dark);
    font-size: 12.5px;
    flex: 1;
    min-width: 0;
    /* Allow text truncation */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .service-name {
        white-space: normal;
        /* Allow wrapping on mobile */
        font-size: 12px;
    }
}

.discount-badge {
    background: #00b4ab;
    color: white;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
    /* Prevent badge from shrinking */
}

/* === TOUCH-FRIENDLY IMPROVEMENTS === */
@media (hover: none) and (pointer: coarse) {

    /* Improve touch targets on mobile */
    .provider-item,
    .phone-badge,
    .service-item {
        min-height: 44px;
        /* Apple's recommended minimum touch target */
    }

    .form-control,
    .form-select,
    .btn {
        min-height: 44px;
    }

    /* Remove hover effects on touch devices */
    .provider-item:hover,
    .service-item:hover {
        transform: none;
    }
}

/* === PRINT STYLES === */
@media print {
    .search-container {
        box-shadow: none;
        border: 1px solid #ccc;
        height: auto;
        page-break-inside: avoid;
    }

    .results-layout {
        height: auto;
        flex-direction: column;
    }

    .results-list,
    .details-panel {
        max-height: none;
        overflow: visible;
    }
}