/**
 * Carequality Locator Styles
 * Version 1.0.0
 * 
 * Navy blue/teal theme matching Carequality branding
 */

/* =========================================================================
   CSS VARIABLES - Carequality Branding
   ========================================================================= */

:root {
    --cq-primary: #071755;
    --cq-primary-light: #1a3a5c;
    --cq-primary-dark: #071755;
    --cq-secondary: #02a3d1;
    --cq-accent: #02a3d1;
    --cq-success: #90D00B;
    
    --cq-text: #071755;
    --cq-text-light: #6b7280;
    --cq-text-muted: #9ca3af;
    
    --cq-bg: #ffffff;
    --cq-bg-secondary: #f9fafb;
    --cq-bg-tertiary: #f3f4f6;
    
    --cq-border: #dfe1e5;
    --cq-border-light: #f3f4f6;
    
    --cq-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --cq-shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);
    
    --cq-radius: 4px;
}

/* =========================================================================
   RESET & BASE
   ========================================================================= */

.cq-locator,
.cq-locator * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.cq-locator {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--cq-text);
    background: var(--cq-bg);
}

/* =========================================================================
   TOP BAR - Search Area
   ========================================================================= */

.search-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    max-width: 1400px;
    margin: 0 auto;
}

.search-row-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    width: 100%;
    margin: 0 auto;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
}

.search-org,
.search-city,
.search-state,
.search-zip,
.search-radius {
    position: relative;
    flex: 1;
    border-right: 1px solid var(--cq-border);
}

.search-org { flex: 2; }
.search-city { flex: 1.5; }
.search-state { flex: 1.2; }
.search-zip { flex: 1; }
.search-radius { flex: 1.2; border-right: none; }

.search-row-wrapper input[type=text],
.search-row-wrapper select {
    border: none;
    height: 48px;
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    background: white;
    color: var(--cq-text);
}

.search-row-wrapper input[type=text]:focus,
.search-row-wrapper select:focus {
    outline: none;
    background: var(--cq-bg-secondary);
}

.search-row-wrapper input[type=text]::placeholder {
    color: var(--cq-text-muted);
}

.state-select,
.radius-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.btn-icon.clear-btn {
    background: transparent;
    border: none;
    color: var(--cq-text-muted);
    padding: 12px 16px;
    cursor: pointer;
    font-size: 16px;
    height: 48px;
    display: flex;
    align-items: center;
}

.btn-icon.clear-btn:hover {
    color: var(--cq-text);
}

.search-btn {
    background: var(--cq-secondary) !important;
    color: white !important;
    border: none;
    padding: 12px 32px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    height: 48px;
    border-radius: 0 4px 4px 0;
    white-space: nowrap;
}

.search-btn:hover {
    background: #00a0a0 !important;
}

/* Section Headers */
.section-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--cq-primary);
    letter-spacing: 0.5px;
    margin: 0 0 15px 0;
    padding: 15px 0 0 0;
}
    box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.2);
}

.search-btn {
    padding: 12px 30px;
    background: var(--cq-secondary);
    color: white;
    border: none;
    border-radius: var(--cq-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    height: 44px;
}

.search-btn:hover {
    background: #0f766e;
}

.topbar-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    padding: 10px 0;
}

.topbar-links a {
    color: #5eead4;
    text-decoration: none;
    font-size: 14px;
}

.topbar-links a:hover {
    text-decoration: underline;
}

.cq-locator div#search-filter .search-dividers {
   margin-bottom: 0;
}

/* =========================================================================
   AUTOCOMPLETE
   ========================================================================= */

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--cq-border);
    border-radius: var(--cq-radius);
    box-shadow: var(--cq-shadow-lg);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}

.autocomplete-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--cq-border-light);
    text-align: left;
}

.autocomplete-item:hover {
    background: var(--cq-bg-secondary);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-name {
    font-weight: 600;
    color: var(--cq-text);
}

.autocomplete-meta {
    font-size: 12px;
    color: var(--cq-text-light);
}

/* =========================================================================
   FILTERS PANEL
   ========================================================================= */

.filter-toggle {
    padding: 8px 16px;
    background: white;
    border: 1px solid var(--cq-border);
    border-radius: var(--cq-radius);
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-toggle:hover {
    background: var(--cq-bg-tertiary);
}

.filter-toggle.has-filters {
    border-color: var(--cq-secondary);
    color: var(--cq-secondary);
}

.filters-panel {
    padding: 20px;
    background: white;
    border-top: 1px solid var(--cq-border);
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
    width: 100%;
}

.filter-group {
    flex: 1;
    min-width: 180px;
}

.filter-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--cq-text);
    margin-bottom: 6px;
    text-transform: uppercase;
}

.filter-group small {
    display: block;
    font-size: 11px;
    color: var(--cq-text-muted);
    margin-top: 4px;
}

.filter-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--cq-border);
    border-radius: var(--cq-radius);
    font-size: 13px;
    background: white;
}

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

.filter-select[multiple] {
    padding: 8px;
}

.filter-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
    justify-content: flex-end;
}

.filter-actions .btn {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-light {
    background: var(--cq-bg-tertiary);
    color: var(--cq-text);
    border: 1px solid var(--cq-border);
    padding: 8px 16px;
    border-radius: var(--cq-radius);
    cursor: pointer;
    font-size: 13px;
}

.btn-light:hover {
    background: var(--cq-bg-secondary);
}

/* =========================================================================
   RESULTS BAR
   ========================================================================= */

.cq-results-bar {
    display: flex;
    justify-content: space-between;
    padding: 0px 15px 5px;
    background: var(--cq-bg-secondary);
    border-bottom: 1px solid var(--cq-border);
    gap: 10px;
}

.cq-results-bar  .btn-clean.select-btn, .topbar-links [data-action="view-all"] {
   display: none;
}

body .download-dropdown button.btn-clean.export-btn {
    padding: 12px 23px 12px 23px;
    border-radius: 4px;
    font-size: 13px;
}

.results-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    max-width: 365px;
}

.results-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    width: 70%;
    justify-content: space-between;
}
.results-tool-r {
    display: flex;
    gap: 20px;
    align-items: center;
}
button.filter-badge-remove {
    padding: 2px 5px !important;
}
body button.btn-light.filter-toggle {
    background: none !important;
    border: none;
    color: #02a3d1;
    padding-left: 0;
    padding-right: 0;
}
div#search-filter .search-buttons {
   justify-content: space-between;
}
.back-btn {
    padding: 6px 12px;
    background: var(--cq-bg);
    border: 1px solid var(--cq-border);
    border-radius: var(--cq-radius);
    cursor: pointer;
    font-size: 13px;
    color: var(--cq-secondary);
    font-weight: 500;
}

.back-btn:hover {
    background: var(--cq-bg-tertiary);
}

.search-label {
    color: var(--cq-text);
    font-size: 13px;
    max-width: 250px;
}

.results-info button.back-btn {
    background: none;
    padding: 0;
    border: none;
    color: var(--cq-text-light);
    font-size: 13px;
    font-weight: 500;
}

.search-label strong {
    color: var(--cq-text);
}

.results-count {
    color: var(--cq-text-light);
    font-size: 14px;
}

.next-link {
    color: var(--cq-secondary);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
}

.next-link:hover {
    text-decoration: underline;
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 15px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--cq-border);
    border-radius: var(--cq-radius);
    background: white;
    color: var(--cq-text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.page-link:hover:not(.disabled):not(.current) {
    background: var(--cq-bg-tertiary);
    border-color: var(--cq-secondary);
    color: var(--cq-secondary);
}

.page-link.current {
    background: var(--cq-secondary);
    border-color: var(--cq-secondary);
    color: white;
    cursor: default;
}

.page-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--cq-bg-tertiary);
}

.page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 32px;
    color: var(--cq-text-muted);
    font-size: 14px;
}

/* Sort & Filter */
.sort-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-dropdown label {
    color: var(--cq-text-light);
    font-size: 13px;
}

.sort-select,
.radius-select {
    padding: 6px 10px;
    border: 1px solid var(--cq-border);
    border-radius: var(--cq-radius);
    background: white;
    font-size: 13px;
    cursor: pointer;
}

.sort-select:focus,
.radius-select:focus {
    outline: none;
    border-color: var(--cq-secondary);
}

/* Filter Badges */
.filter-badge-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #e0f2f1;
    color: var(--cq-primary);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.filter-badge-remove {
    background: none;
    border: none;
    color: var(--cq-primary);
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    padding: 0;
    line-height: 1;
}

.filter-badge-remove:hover {
    color: #dc2626;
}

.clear-all-link {
    color: var(--cq-secondary);
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
}

/* Selection Controls */
.selection-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

#selection-count {
    color: var(--cq-text-light);
    min-width: 80px;
}

.btn-clean {
    background: none;
    border: none;
    color: var(--cq-secondary);
    cursor: pointer;
    font-size: 13px;
    padding: 4px 8px;
}

.btn-clean:hover {
    text-decoration: underline;
}

.select-btn,
.export-btn {
    font-weight: 500;
}

/* Download Menu */
.download-dropdown {
    position: relative;
}

.download-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--cq-border);
    border-radius: var(--cq-radius);
    box-shadow: var(--cq-shadow-lg);
    z-index: 100;
    min-width: 195px;
    padding-bottom: 15px;
}

.download-menu button {
    display: block;
    width: 100%;
    padding: 14px 16px 0px !important;
    text-align: left;
    background: none !important;
    border: none;
    cursor: pointer;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: var(--cq-text) !important;
}

.download-menu button:hover {
    color: var(--cq-secondary) !important;
}

.download-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--cq-text);
    cursor: pointer;
    border-bottom: 1px solid var(--cq-border);
}

.download-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--cq-secondary);
}

/* =========================================================================
   MAIN CONTENT LAYOUT
   ========================================================================= */

.cq-content {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 500px;
}

.cq-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.cq-sidebar {
    width: 380px;
    min-width: 380px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--cq-border);
    background: var(--cq-bg);
}

.cq-results {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.sidebar-pagination {
    padding: 10px;
    border-top: 1px solid var(--cq-border);
    background: var(--cq-bg-secondary);
    display: flex;
    justify-content: center;
}

.cq-map-container {
    flex: 1;
    position: relative;
}

.cq-map {
    width: 100%;
    height: 100%;
    min-height: 400px;
}

/* =========================================================================
   ORGANIZATION CARDS
   ========================================================================= */

.org-card {
    display: flex;
    align-items: flex-start;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
     min-height: 30px;
     padding: 7px 5px;
     margin-top: 5px;
     margin-bottom: 5px;
     border: none;
     border-bottom: 1px solid var(--cq-border);
}

.org-card:hover {
    border-color: var(--cq-secondary);
}

.org-card.selected {
    border-color: var(--cq-secondary);
    background: #e0f2f1;
}

.org-card.highlighted {
    border-color: var(--cq-accent);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.3);
}

.org-checkbox {
    margin-top: 4px;
    width: 18px;
    height: 18px;
    accent-color: var(--cq-secondary);
    cursor: pointer;
}

.org-card-content {
    flex: 1;
    min-width: 0;
}

.org-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
     word-wrap: break-word;
     font-family: "Jost", Sans-serif;
     width: 100%;
     color: #071755;
     font-weight: 500;
     font-size: 16px;
      line-height: 1.1em;
}

.org-name {
    font-weight: 600;
    color: var(--cq-text);
    font-size: 16px;
    word-break: break-word;
}

.org-distance {
    display: inline-block;
    background: var(--cq-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
    white-space: nowrap;
}

.org-location {
    font-size: 13px;
    color: var(--cq-text-light);
    margin-bottom: 6px;
}

.org-parent,
.org-subcount {
    font-size: 12px;
    color: var(--cq-text-light);
    margin-top: 4px;
}

.org-parent a,
.org-subcount a {
    color: var(--cq-secondary);
    text-decoration: none;
}

.org-parent a:hover,
.org-subcount a:hover {
    text-decoration: underline;
}

.org-type-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.org-type-badge.participant {
    background: #edf8fc;
    color: #058eb5;
}

.org-type-badge.subparticipant {
  background: #f8ffe9;
   color: #6dac04;
}

/* =========================================================================
   NO RESULTS
   ========================================================================= */

.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.no-results-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.no-results h3 {
    font-size: 18px;
    color: var(--cq-text);
    margin-bottom: 8px;
}

.no-results p {
    color: var(--cq-text-light);
    margin-bottom: 20px;
}

/* =========================================================================
   MAP LEGEND
   ========================================================================= */

.map-legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: white;
    padding: 12px 20px;
    border-radius: var(--cq-radius);
    box-shadow: var(--cq-shadow-lg);
    display: flex;
    gap: 25px;
    z-index: 10;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-dot.participant {
    background: #02a3d1; 
}

.legend-dot.subparticipant {
    background: #90D00B;
}

/* =========================================================================
   INFO WINDOW
   ========================================================================= */

.cq-infowindow {
    padding: 8px;
    max-width: 280px;
}

.cq-infowindow h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--cq-text);
}

.cq-infowindow .org-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    margin-bottom: 8px;
}

.cq-infowindow .org-type-badge.participant {
    background: #fef3c7;
    color: #92400e;
}

.cq-infowindow .org-type-badge.subparticipant {
    background: #dbeafe;
    color: #1e40af;
}

.cq-infowindow .address {
    font-size: 13px;
    color: var(--cq-text-light);
    margin-bottom: 8px;
}

.cq-infowindow .distance {
    color: var(--cq-primary);
    font-weight: 600;
    font-size: 13px;
    margin: 5px 0;
}

.cq-infowindow .subparticipant-link,
.cq-infowindow .parent-link {
    font-size: 13px;
    color: var(--cq-text-light);
    padding-top: 8px;
    border-top: 1px solid var(--cq-border);
    margin-top: 8px;
}

.cq-infowindow .subparticipant-link a,
.cq-infowindow .parent-link a {
    color: var(--cq-secondary);
    text-decoration: none;
    font-weight: 500;
}

.cq-infowindow .subparticipant-link a:hover,
.cq-infowindow .parent-link a:hover {
    text-decoration: underline;
}

/* =========================================================================
   BUTTONS
   ========================================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--cq-radius);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #02a3d1 !important;
    color: white;
    font-size: 14px !important;
}

.btn-primary:hover {
    background: #90D00A !important;
}

.btn-secondary {
    background: var(--cq-bg-tertiary);
    color: var(--cq-text);
    border: 1px solid var(--cq-border);
}

.btn-secondary:hover {
    background: var(--cq-bg-secondary);
}

/* =========================================================================
   LOADING & ERROR STATES
   ========================================================================= */

.cq-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.cq-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--cq-border);
    border-top-color: var(--cq-secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.cq-loading p {
    color: var(--cq-text);
    font-size: 16px;
    margin-bottom: 8px;
}

.cq-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.error-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.cq-error h3 {
    font-size: 20px;
    color: var(--cq-text);
    margin-bottom: 10px;
}

.cq-error p {
    color: var(--cq-text-light);
    margin-bottom: 20px;
}

/* =========================================================================
   RADIUS FILTER
   ========================================================================= */

.search-radius {
    display: none;
    align-items: center;
}

.search-radius.visible {
    display: flex;
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */

@media (max-width: 1024px) {
    .cq-main {
        flex-direction: column;
    }
    
    .cq-sidebar {
        width: 100%;
        min-width: unset;
        border-right: none;
        border-bottom: 1px solid var(--cq-border);
    }
    
    .cq-results {
        max-height: 400px;
    }
    
    .cq-map {
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    .cq-topbar {
        padding: 20px 15px;
    }
    
    .topbar-title p {
        font-size: 18px;
    }
    
    .search-row {
        flex-direction: column;
    }
    
    .search-row-wrapper {
        flex-direction: column;
        gap: 8px;
        padding: 8px;
    }
    
    .search-org,
    .search-location {
        max-width: 100%;
        width: 100%;
    }
    
    input#search-input,
    input#location-input {
        border-radius: 5px !important;
    }
    
    .search-btn {
        width: 100%;
    }
    
    .search-radius {
        width: 100%;
    }
    
    .cq-results-bar {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .results-info {
        flex-wrap: wrap;
    }
    
    .results-toolbar {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .sidebar-pagination {
        padding: 8px;
    }
    
    .pagination-controls {
        margin-left: 0;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .selection-controls {
        flex-wrap: wrap;
        gap: 5px;
        font-size: 12px;
        width: 100%;
        justify-content: center;
    }
    
    #selection-count {
        width: 100%;
        text-align: center;
        min-width: auto;
    }
}
