/* Discover Providers Specific Styles */

/* Search Header */
.search-header {
    margin-bottom: var(--space-3xl);
}

.search-title {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.search-title h1 {
    font-size: var(--text-3xl);
    font-weight: var(--fw-bold);
    color: var(--text);
    margin-bottom: var(--space-s);
}

.search-title p {
    font-size: var(--text-lg);
    color: var(--text-muted);
    margin: 0;
}

/* Advanced Search Container */
.advanced-search-container {
    max-width: 800px;
    margin: 0 auto;
}

.search-input-container {
    position: relative;
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-m) var(--space-l);
    margin-bottom: var(--space-l);
    transition: border-color 0.3s ease;
}

.search-input-container:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-icon {
    color: var(--text-muted);
    margin-right: var(--space-s);
}

.search-input {
    flex: 1;
    border: none;
    background: none;
    font-size: var(--text-base);
    color: var(--text);
    outline: none;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: 50%;
    transition: all 0.2s ease;
}

.search-clear:hover {
    background: var(--panel-subtle);
    color: var(--text);
}

/* Filter Row */
.filter-row {
    display: flex;
    gap: var(--space-m);
    align-items: center;
    margin-bottom: var(--space-l);
    flex-wrap: wrap;
}

.filter-select {
    flex: 1;
    min-width: 150px;
    padding: var(--space-s) var(--space-m);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: var(--text-sm);
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-s) var(--space-m);
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: var(--text-sm);
    color: var(--text);
    white-space: nowrap;
}

.filter-toggle:hover,
.filter-toggle.active {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

/* Advanced Filters Panel */
.advanced-filters {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: var(--space-l);
    margin-bottom: var(--space-l);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filter-group {
    margin-bottom: var(--space-l);
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-label {
    display: block;
    font-weight: var(--fw-semibold);
    color: var(--text);
    margin-bottom: var(--space-s);
    font-size: var(--text-sm);
}

/* Price Range */
.price-range {
    display: flex;
    align-items: center;
    gap: var(--space-s);
}

.price-input {
    flex: 1;
    padding: var(--space-s);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: var(--text-sm);
}

.currency-display {
    font-size: var(--text-sm);
    color: var(--text-muted);
    font-weight: var(--fw-medium);
}

/* Rating Filters */
.rating-filters {
    display: flex;
    gap: var(--space-m);
    flex-wrap: wrap;
}

.rating-option {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.rating-option input[type="radio"] {
    margin-right: var(--space-xs);
}

.rating-display {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--text-sm);
    color: var(--text);
}

.rating-display i {
    color: #fbbf24;
}

/* Availability Filters */
.availability-filters {
    display: flex;
    flex-direction: column;
    gap: var(--space-s);
}

.checkbox-option {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.checkbox-option input[type="checkbox"] {
    margin-right: var(--space-s);
}

.checkbox-option span {
    font-size: var(--text-sm);
    color: var(--text);
}

/* Filter Actions */
.filter-actions {
    display: flex;
    gap: var(--space-m);
    justify-content: flex-end;
    margin-top: var(--space-l);
    padding-top: var(--space-l);
    border-top: 1px solid var(--border);
}

.btn-secondary {
    padding: var(--space-s) var(--space-l);
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: var(--text-sm);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--panel-subtle);
    border-color: var(--text);
}

.btn-primary {
    padding: var(--space-s) var(--space-l);
    background: var(--primary);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: var(--text-sm);
    color: white;
    font-weight: var(--fw-medium);
    min-height: 44px;
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline {
    padding: var(--space-m) var(--space-xl);
    background: white;
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: var(--text-sm);
    color: var(--primary);
    font-weight: var(--fw-medium);
    display: flex;
    align-items: center;
    gap: var(--space-s);
    min-height: 44px;
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

/* Results Summary */
.results-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2xl);
    padding-bottom: var(--space-l);
    border-bottom: 1px solid var(--border);
}

#resultsCount {
    font-size: var(--text-base);
    color: var(--text-muted);
    font-weight: var(--fw-medium);
}

.view-toggle {
    display: flex;
    gap: var(--space-xs);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.view-btn {
    padding: var(--space-s);
    background: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-muted);
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn:hover,
.view-btn.active {
    background: var(--primary);
    color: white;
}

/* Loading Container */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-3xl);
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: var(--space-l);
}

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

.loading-container p {
    color: var(--text-muted);
    font-size: var(--text-base);
    margin: 0;
}

/* Providers Container */
.providers-container {
    min-height: 400px;
}

.providers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-xl);
    margin-bottom: var(--space-3xl);
    padding: 0 var(--space-m);
}

.providers-grid.list-view {
    grid-template-columns: 1fr;
    gap: var(--space-l);
}

/* Enhanced Provider Cards */
.provider-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

.provider-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
    border-color: var(--primary);
}

.provider-card.list-view {
    display: flex;
    align-items: stretch;
}

.provider-image {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.provider-card.list-view .provider-image {
    width: 200px;
    height: 150px;
    flex-shrink: 0;
}

.provider-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.provider-card:hover .provider-image img {
    transform: scale(1.05);
}

.provider-status {
    position: absolute;
    top: var(--space-s);
    right: var(--space-s);
    padding: var(--space-xs) var(--space-s);
    border-radius: var(--radius);
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    backdrop-filter: blur(4px);
}

.provider-status.open {
    background: rgba(22, 163, 74, 0.9);
    color: white;
}

.provider-status.closed {
    background: rgba(220, 38, 38, 0.9);
    color: white;
}

.provider-distance {
    position: absolute;
    bottom: var(--space-s);
    left: var(--space-s);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: var(--space-xs) var(--space-s);
    border-radius: var(--radius);
    font-size: var(--text-xs);
    font-weight: var(--fw-medium);
    backdrop-filter: blur(4px);
}

.provider-info {
    padding: var(--space-l);
    flex: 1;
}

.provider-name {
    font-size: var(--text-lg);
    font-weight: var(--fw-bold);
    color: var(--text);
    margin-bottom: var(--space-xs);
    line-height: 1.2;
}

.provider-address {
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin-bottom: var(--space-s);
    line-height: 1.4;
}

.provider-rating {
    display: flex;
    align-items: center;
    gap: var(--space-s);
    margin-bottom: var(--space-m);
}

.stars {
    color: #fbbf24;
    font-size: var(--text-sm);
}

.rating-text {
    color: var(--text-muted);
    font-size: var(--text-2xs);
}

.provider-price-range {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-m);
    color: var(--text);
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
}

.provider-services {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-bottom: var(--space-m);
}

.service-tag {
    padding: var(--space-xs) var(--space-s);
    background: var(--panel-subtle);
    color: var(--text-muted);
    border-radius: var(--radius);
    font-size: var(--text-xs);
    font-weight: var(--fw-medium);
}

.provider-actions {
    display: flex;
    gap: var(--space-s);
    margin-top: var(--space-m);
    padding-top: var(--space-m);
    border-top: 1px solid var(--border);
}

.action-btn {
    flex: 1;
    padding: var(--space-s) var(--space-m);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    min-height: 44px;
    text-decoration: none;
}

.action-btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.action-btn.primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.action-btn.secondary {
    background: white;
    color: var(--text);
}

.action-btn.secondary:hover {
    background: var(--panel-subtle);
    border-color: var(--text);
}

/* Load More Container */
.load-more-container {
    display: flex;
    justify-content: center;
    margin-top: var(--space-2xl);
}

.load-more-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Empty and Error States */
.empty-state,
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-3xl);
    text-align: center;
    background: white;
    border-radius: var(--radius-card);
    border: 1px solid var(--border);
}

.empty-icon,
.error-icon {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: var(--space-l);
}

.error-icon {
    color: #dc2626;
}

.empty-state h3,
.error-state h3 {
    font-size: var(--text-xl);
    font-weight: var(--fw-bold);
    color: var(--text);
    margin-bottom: var(--space-s);
}

.empty-state p,
.error-state p {
    color: var(--text-muted);
    font-size: var(--text-base);
    margin-bottom: var(--space-xl);
    line-height: 1.5;
}

/* Provider Modal Enhancements */
.provider-modal-content {
    max-width: 800px;
    max-height: 90vh;
}

.provider-detail-header {
    position: relative;
    height: 250px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: var(--space-l);
    display: flex;
    align-items: flex-end;
}

.provider-detail-header img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.provider-detail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.7) 100%);
    z-index: 2;
}

.provider-detail-info {
    position: relative;
    z-index: 3;
}

.provider-detail-content {
    padding: var(--space-l);
}

.detail-section {
    margin-bottom: var(--space-xl);
}

.detail-section h4 {
    font-size: var(--text-lg);
    font-weight: var(--fw-bold);
    color: var(--text);
    margin-bottom: var(--space-m);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-m);
}

.service-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-m);
    background: var(--panel-subtle);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.service-details {
    flex: 1;
}

.service-name {
    font-weight: var(--fw-semibold);
    color: var(--text);
    margin-bottom: var(--space-xs);
}

.service-duration {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.service-price {
    font-weight: var(--fw-bold);
    color: var(--primary);
    white-space: nowrap;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .search-title h1 {
        font-size: var(--text-2xl);
    }

    .filter-row {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-select,
    .filter-toggle {
        width: 100%;
    }

    .advanced-filters {
        padding: var(--space-m);
    }

    .filter-actions {
        flex-direction: column;
    }

    .results-summary {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-m);
    }

    .providers-grid {
        grid-template-columns: 1fr;
        gap: var(--space-m);
        padding: 0 var(--space-s);
    }

    .provider-card.list-view {
        flex-direction: column;
    }

    .provider-card.list-view .provider-image {
        width: 100%;
        height: 200px;
    }

    .provider-actions {
        flex-direction: column;
    }

    .provider-modal-content {
        margin: var(--space-s);
        max-width: none;
        width: calc(100% - 2 * var(--space-s));
    }

    .services-grid {
        grid-template-columns: 1fr;
    }
}

/* Additional responsive utilities */
@media (hover: none) and (pointer: coarse) {
    /* Touch device optimizations */
    .filter-select:active,
    .filter-toggle:active,
    button:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
    
    /* Ensure minimum touch targets */
    .filter-select,
    .filter-toggle,
    .search-clear,
    .price-input,
    button,
    .provider-card,
    .chip {
        min-height: 44px;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    /* Enhanced touch feedback */
    .provider-card:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
    
    .chip:active,
    .filter-toggle:active {
        transform: scale(0.95);
        background: var(--primary);
        color: white;
    }
}

/* Landscape orientation adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .search-title {
        margin-bottom: var(--space-m);
    }
    
    .search-title h1 {
        font-size: 1.5rem;
    }
    
    .filter-row {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .filter-select {
        flex: 1;
        min-width: 120px;
    }
}

/* Small phones and compact devices */
@media (max-width: 480px) {
    .search-input-container {
        padding: var(--space-xs) var(--space-s);
        margin: 0 var(--space-s);
    }
    
    /* Ensure touch-friendly form elements */
    input, select, textarea, button {
        font-size: 16px !important; /* Prevent iOS zoom */
        -webkit-appearance: none;
    }
    
    .filter-select,
    .filter-toggle,
    .price-input {
        min-height: 48px;
        padding: var(--space-m);
        font-size: 16px;
    }
    
    /* Responsive text sizing */
    .search-title h1 {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    .search-title p {
        font-size: 0.9rem;
    }

    .provider-info {
        padding: var(--space-m);
    }

    .provider-detail-header {
        height: 200px;
        padding: var(--space-m);
    }

    .provider-detail-content {
        padding: var(--space-m);
    }

    .service-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-s);
    }
    
    /* Full width elements on mobile */
    .filter-row {
        margin: 0 var(--space-s);
    }
    
    .advanced-filters {
        border-radius: 0;
        margin: 0;
        border-left: none;
        border-right: none;
    }
    
    .price-range {
        flex-direction: column;
        gap: var(--space-m);
    }
    
    .price-input {
        width: 100%;
    }
}

/* iOS Safari specific optimizations */
@supports (-webkit-touch-callout: none) {
    /* Fix iOS Safari viewport issues */
    .discovery-header {
        padding-top: env(safe-area-inset-top, 20px);
    }
    
    /* Prevent iOS zoom on input focus */
    input, select, textarea {
        font-size: 16px !important;
        -webkit-appearance: none;
    }
    
    /* Better touch scrolling for iOS */
    .providers-grid, .filter-chips {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Fix iOS Safari sticky positioning */
    .search-header {
        position: -webkit-sticky;
        position: sticky;
        top: 0;
        z-index: 10;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(8px);
    }
}

/* Enhanced mobile interaction states */
@media (max-width: 768px) {
    /* Make filter chips more touch-friendly */
    .chip {
        padding: 8px 16px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
    }
    
    /* Improve provider card touch targets */
    .provider-card {
        min-height: 120px;
        cursor: pointer;
    }
    
    .provider-card-content {
        padding: var(--space-m);
    }
    
    .provider-card-title {
        font-size: 1rem;
        line-height: 1.2;
    }
    
    .provider-image {
        height: 150px;
    }
    
    .action-btn {
        min-height: 48px;
        font-size: 16px;
        padding: 12px 24px;
    }
    
    /* Better spacing for mobile */
    .filter-row {
        gap: 12px;
        margin-bottom: 16px;
    }
    
    .filter-chips {
        gap: 8px;
    }
}