/**
 * Provider Directory Frontend Styles
 * 
 * Clean, professional design for the provider directory
 */

/* ==========================================================================
   Base Styles
   ========================================================================== */

.provider-directory-wrapper {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Hide the default page title when rendering the provider directory */
#content-area h1.entry-title {
    display: none;
}

/* ==========================================================================
   Header Styles
   ========================================================================== */

.directory-header {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 30px;
    margin-bottom: 30px;
    text-align: center;
}

.directory-title {
    font-size: 2rem;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: #212529;
}

.directory-description {
    font-size: 1.1rem;
    margin: 0;
    color: #6c757d;
    max-width: 600px;
    margin: 0 auto;
}

/* ==========================================================================
   Search Form Styles
   ========================================================================== */

.search-section {
    margin-bottom: 30px;
}

.provider-search-form {
    background: #fff;
    border: 1px solid #dee2e6;
    padding: 25px;
    margin-bottom: 30px;
}

.search-form-header {
    text-align: center;
    margin-bottom: 25px;
}

.search-form-header h2 {
    color: #212529;
    font-size: 1.5rem;
    margin: 0 0 8px 0;
    font-weight: 600;
}

.search-description {
    color: #6c757d;
    font-size: 0.95rem;
    margin: 0;
}

.search-form-fields {
    margin-bottom: 25px;
}

/* First Row: Keyword search - not full width */
.search-form-fields-row-1 {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.search-form-fields-row-1 .search-field-group {
    flex: 0 1 400px; /* Limited width, not full width */
    max-width: 400px;
}

/* Second Row: All other filters in one row - using flexbox for flexibility */
.search-form-fields-row-2 {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: nowrap;
}

.search-form-fields-row-2 .search-field-group {
    flex-shrink: 0;
}

/* Category dropdown - fixed width */
.search-form-fields-row-2 .search-field-group:nth-child(1) {
    flex: 0 0 200px; /* Fixed 200px width */
}

/* Specialty dropdown - fixed width */
.search-form-fields-row-2 .search-field-group:nth-child(2) {
    flex: 0 0 250px; /* Fixed 250px width */
}

.search-form-fields-row-2 .search-field-group:nth-child(2) .search-select {
    width: 250px;
    max-width: 250px;
}

/* Search Radius - same width as ZIP Code */
.search-form-fields-row-2 .search-field-group:nth-child(3) {
    flex: 0 0 180px; /* Same as ZIP Code */
}

.search-form-fields-row-2 .search-field-group:nth-child(3) .search-select {
    width: 180px;
    max-width: 180px;
}

/* ZIP Code - compact width */
.search-form-fields-row-2 .search-field-group:nth-child(4) {
    flex: 0 0 180px; /* Fixed 180px width */
}

.search-form-fields-row-2 .search-field-group:nth-child(4) .search-input {
    width: 180px;
    max-width: 180px;
}

/* Responsive: stack on smaller screens */
@media (max-width: 1200px) {
    .search-form-fields-row-2 {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .search-form-fields-row-2 .search-field-group:nth-child(1),
    .search-form-fields-row-2 .search-field-group:nth-child(2) {
        flex: 0 0 calc(50% - 5px); /* Category and Specialty on first row */
    }
    
    .search-form-fields-row-2 .search-field-group:nth-child(3),
    .search-form-fields-row-2 .search-field-group:nth-child(4) {
        flex: 0 0 calc(50% - 5px); /* Search Radius and ZIP Code on second row */
    }
}

@media (max-width: 768px) {
    .search-form-fields-row-1 .search-field-group {
        flex: 1 1 100%;
        max-width: 100%;
    }
    
    .search-form-fields-row-2 {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-form-fields-row-2 .search-field-group {
        flex: 1 1 100% !important; /* All fields full width on mobile */
    }
    
    /* Override fixed widths on mobile - make all fields flexible */
    .search-form-fields-row-2 .search-field-group:nth-child(1),
    .search-form-fields-row-2 .search-field-group:nth-child(2),
    .search-form-fields-row-2 .search-field-group:nth-child(3),
    .search-form-fields-row-2 .search-field-group:nth-child(4) {
        flex: 1 1 100% !important;
    }
    
    .search-form-fields-row-2 .search-field-group:nth-child(1) .search-select,
    .search-form-fields-row-2 .search-field-group:nth-child(2) .search-select,
    .search-form-fields-row-2 .search-field-group:nth-child(3) .search-select,
    .search-form-fields-row-2 .search-field-group:nth-child(4) .search-input {
        width: 100% !important;
        max-width: 100% !important;
    }
}

.search-field-group {
    display: flex;
    flex-direction: column;
    transition: opacity 0.2s ease-in-out;
}

.search-field-group label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.search-input {
    padding: 10px 8px !important;
}
.search-input,
.search-select {
    padding: 10px 14px;
    border: 1px solid #ced4da;
    border-radius: 2px;
    font-size: 0.95rem;
    transition: border-color 0.15s ease-in-out;
    background: #fff;
    min-height: 42px;
    max-height: 42px;
    box-sizing: border-box;
}

/* Safari & Cross-Browser Fix: Ensure consistent select dropdown styling */
.search-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    height: 42px;
    line-height: 1.5;
    /* Custom dropdown arrow for consistent cross-browser styling */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23495057' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 36px; /* Make room for the custom arrow */
}

.search-input:focus,
.search-select:focus {
    outline: none;
    border-color: #134c95;
    box-shadow: 0 0 0 2px rgba(19, 76, 149, 0.25);
}

.search-input::placeholder {
    color: #6c757d;
}


.search-form-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.search-submit-btn {
    background: #134c95;
    color: white;
    border: 1px solid #134c95;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
    min-width: 140px;
}

.search-submit-btn:hover {
    background: #0f3d79;
    border-color: #0a2f5d;
}

.search-submit-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.clear-search-btn {
    background: #fff;
    color: #6c757d;
    border: 1px solid #ced4da;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.clear-search-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #495057;
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-right: 6px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Search Results Styles
   ========================================================================== */

.results-section {
    margin-bottom: 30px;
}

.search-results-container {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 1px;
    overflow: hidden;
}

.search-results-header {
    background: #f8f9fa;
    padding: 20px 25px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.results-title {
    margin: 0;
    color: #212529;
    font-size: 1.3rem;
    font-weight: 600;
}

.results-count {
    color: #6c757d;
    font-size: 0.95rem;
}

.results-number {
    font-weight: 600;
    color: #134c95;
}

.results-loading {
    text-align: center;
    padding: 50px 25px;
    color: #6c757d;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e9ecef;
    border-radius: 50%;
    border-top-color: #134c95;
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto 15px auto;
}

/* ==========================================================================
   Provider Listing Styles
   ========================================================================== */

.provider-listing {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 900px) {
    .provider-listing {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .provider-listing {
        grid-template-columns: 1fr;
    }
}

.provider-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 2px;
    padding: 16px;
    transition: all 0.15s ease-in-out;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
}

.provider-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.provider-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    gap: 15px;
}

.provider-name {
    flex: 1;
}

.provider-title {
    margin: 0;
    color: #134c95;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.1;
}

.provider-title-degree {
    color: #6c757d;
    font-weight: 400;
}

.provider-name-korean {
    margin: 0 0 8px 0;
    color: #134c95;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: 'Noto Sans KR', sans-serif;
}

.provider-photo {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.provider-default-photo {
    object-fit: contain;
    background: #f0f0f0;
}

.category-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    /* text-transform: uppercase; */
    letter-spacing: 0.5px;
    margin-top: 8px;
    background: #f6f5f5;
    color: #134c95;
}

/* .category-pcp { background: #e8f5e8; color: #2e7d32; }
.category-specialists { background: #e3f2fd; color: #1565c0; }
.category-ancillary { background: #fff3e0; color: #ef6c00; }
.category-urgent-care { background: #ffebee; color: #c62828; }
.category-hospitals { background: #f3e5f5; color: #7b1fa2; } */

.provider-specialty-section {
    margin: 0 0 12px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.provider-specialties-header {
    color: #495057;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.3;
}

.provider-content {
    display: block;
}

.provider-location {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.provider-location:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.location-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.location-icon {
    color: #144c95;
    margin-right: 8px;
    font-size: 1rem;
}

.location-address {
    font-weight: 600;
    color: #134c95;
    font-size: 0.9rem;
}

.location-address-link {
    text-decoration: none;
    transition: color 0.15s ease-in-out;
}

.location-address-link:hover {
    color: #134c95;
    text-decoration: underline;
}

.location-address-link:focus {
    outline: 2px solid #134c95;
    outline-offset: 2px;
}

.location-distance {
    margin-left: auto;
    color: #666;
    font-size: 0.85rem;
}

.location-phone {
    display: flex;
    align-items: center;
    color: #144c95;
    font-size: 0.9rem;
    text-decoration: none;
    margin-top: 4px;
}

.location-phone:hover {
    text-decoration: underline;
}

.phone-icon {
    margin-right: 6px;
    font-size: 0.9rem;
}

.location-fax {
    display: flex;
    align-items: center;
    color: #144c95;
    font-size: 0.9rem;
    margin-top: 4px;
}

.fax-icon {
    margin-right: 6px;
    font-size: 0.9rem;
}

.additional-locations {
    /* margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0; */
}
/* .additional-locations:not(:last-child) {
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
    margin-bottom: 10px;
} */

.additional-locations .provider-location {
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.additional-locations h4 {
    color: #666;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.additional-locations .provider-location:not(:last-child) {
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
}

.hidden-locations {
    display: none;
}

.clickable-toggle {
    cursor: pointer;
    user-select: none;
}

.clickable-toggle:hover {
    color: #134c95;
}

.toggle-icon {
    font-weight: bold;
    margin-left: 4px;
}

.provider-details {
    /* margin-top: 15px;
    padding-top: 15px; */
    /* border-top: 1px solid #e0e0e0; */
}

.provider-details h4 {
    margin: 0 0 5px 0;
    color: #666;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.provider-details > div {
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: #666;
}

.provider-details > div:last-child {
    margin-bottom: 0;
}

.provider-details strong {
    color: #212529;
    font-weight: 600;
}

.provider-actions {
    margin-top: 15px;
}

.provider-profile-link {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 4px;
    background: #134c95;
    color: #fff;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border: 1px solid #134c95;
    transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.provider-profile-link:hover {
    background: #0f3d79;
    border-color: #0a2f5d;
}

/* ==========================================================================
   No Results Styles
   ========================================================================== */

.no-results {
    text-align: center;
    padding: 50px 25px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.no-results-content h3 {
    color: #212529;
    font-size: 1.3rem;
    margin: 0 0 12px 0;
}

.no-results-content p {
    color: #6c757d;
    font-size: 0.95rem;
    margin: 0 0 20px 0;
}

.modify-search-btn {
    background: #134c95;
    color: white;
    border: 1px solid #134c95;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.modify-search-btn:hover {
    background: #0f3d79;
    border-color: #0a2f5d;
}

/* ==========================================================================
   Welcome Message Styles
   ========================================================================== */

.welcome-message {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 30px;
    text-align: center;
}

.welcome-message h2 {
    color: #212529;
    font-size: 1.5rem;
    margin: 0 0 15px 0;
}

.welcome-message p {
    color: #6c757d;
    font-size: 1rem;
    margin: 0 0 20px 0;
}

.search-features {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
    max-width: 400px;
    margin: 0 auto;
}

.search-features li {
    padding: 6px 0;
    color: #495057;
    position: relative;
    padding-left: 20px;
}

.search-features li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #28a745;
    font-weight: bold;
}


/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .provider-directory-wrapper {
        padding: 15px;
    }
    
    .directory-title {
        font-size: 1.7rem;
    }
    
    .directory-description {
        font-size: 1rem;
    }
    
    .provider-search-form {
        padding: 20px;
    }
    
    .search-form-fields {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .location-inputs {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-form-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .search-submit-btn,
    .clear-search-btn {
        width: 100%;
        max-width: 280px;
    }
    
    .provider-listing {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .provider-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .search-results-header {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        padding: 15px 20px;
    }
    
    /* Additional styles for smaller screens */
    .directory-title {
        font-size: 1.5rem;
    }
    
    .provider-card {
        padding: 20px;
    }
    
    .provider-specialties,
    .provider-addresses,
    .provider-details {
        padding: 15px;
    }
    
    .provider-pagination {
        padding: 15px 20px;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for keyboard navigation */
.search-input:focus,
.search-select:focus,
.search-submit-btn:focus,
.clear-search-btn:focus,
.location-detect-btn:focus {
    outline: 2px solid #134c95;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .provider-card {
        border: 2px solid #000;
    }
    
    .category-badge {
        border: 1px solid #000;
    }
}
/* ==========================================================================
   Pagination Styles
   ========================================================================== */

.provider-pagination {
    margin-top: 30px;
    padding: 20px 0;
    text-align: center;
    border-top: 1px solid #e0e0e0;
}

.provider-pagination .pagination-info {
    margin-bottom: 12px;
    color: #6c757d;
    font-size: 0.95rem;
}

.provider-pagination .pagination-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.provider-pagination .pagination-link,
.provider-pagination .page-numbers {
    display: inline-block;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #dee2e6;
    color: #134c95;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.15s ease-in-out;
    min-width: 40px;
    text-align: center;
}

.provider-pagination .pagination-link:hover,
.provider-pagination .page-numbers:hover,
.provider-pagination .pagination-link.current,
.provider-pagination .page-numbers.current {
    background: #134c95;
    color: #fff;
    border-color: #134c95;
}

.provider-pagination .pagination-link.current {
    cursor: default;
    pointer-events: none;
}

.provider-pagination .pagination-link.prev,
.provider-pagination .pagination-link.next,
.provider-pagination .page-numbers.prev,
.provider-pagination .page-numbers.next {
    font-weight: 500;
}

/* Responsive pagination */
@media (max-width: 768px) {
    .provider-pagination .pagination-link,
    .provider-pagination .page-numbers {
        padding: 6px 8px;
        min-width: 35px;
        font-size: 0.9rem;
    }
}

/* ==========================================================================
   Location Button Styles
   ========================================================================== */

.zip-code-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.use-location-btn {
    background: #144c95;
    color: white;
    border: none;
    padding: 10px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: 140px;
    justify-content: center;
}

.use-location-btn:hover {
    background: #517fbc;
    transform: translateY(-1px);
}

.use-location-btn:active {
    transform: translateY(0);
}

.use-location-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.use-location-btn .location-icon {
    font-size: 1rem;
    color: #fff; /* Keep icon white inside the blue button */
}

.use-location-btn .location-loading {
    display: flex;
    align-items: center;
    gap: 4px;
}

.use-location-btn .spinner {
    width: 12px;
    height: 12px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Location feedback messages */
.location-feedback {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    display: none;
}

.location-feedback.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.location-feedback.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Distance labels */
.location-distance {
    font-size: 0.75rem;
    color: #3f464d;
    font-weight: 400;
    margin-top: 2px;
    font-style: italic;
    line-height: 1.2;
}

/* Responsive location button */
@media (max-width: 768px) {
    .zip-code-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .use-location-btn {
        min-width: auto;
        width: 100%;
    }
}
