/**
 * California Agencies Map Styles
 */

.california-map-container {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 40px 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Override Elementor/theme container restrictions */
.site-main .california-map-container,
.elementor-section .california-map-container {
    max-width: 100% !important;
    width: 100% !important;
}

.site-main .california-map-wrapper,
.elementor-section .california-map-wrapper {
    display: flex !important;
    flex-direction: row !important;
}

.california-map-header {
    text-align: center;
    margin-bottom: 40px;
}

.california-map-header h2 {
    font-size: 2.5rem;
    color: #0066cc;
    margin-bottom: 10px;
    font-weight: 700;
}

.map-subtitle {
    color: #666;
    font-size: 1.1rem;
    margin: 0;
}

.california-map-wrapper {
    position: relative;
    background: var(--color-bg-alt, #f4f6fb);
    border-radius: var(--border-radius-xl, 16px);
    padding: 40px;
    box-shadow: var(--shadow-lg, 0 10px 40px rgba(0, 0, 0, 0.1));
    margin-bottom: 60px;
    display: grid;
    gap: 32px;
    min-height: 560px;
    border: 1px solid var(--color-border-light, #e7ebf9);
}

.california-map-wrapper.has-detail-panel {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
    align-items: start;
}

.california-map-wrapper.california-map--no-detail,
.california-map-wrapper:not(.has-detail-panel) {
    grid-template-columns: minmax(0, 1fr);
}

.map-container {
    position: relative;
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 520px;
}

.california-map-svg {
    width: 100%;
    height: auto;
    max-width: 100%;
    display: block;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.california-state {
    transition: all 0.3s ease;
}

.california-state:hover {
    fill: #d4e9f7;
}

/* Agency Markers */
.agency-marker {
    cursor: pointer;
    transition: all 0.3s ease;
}

.marker-circle {
    transition: all 0.3s ease;
}

.agency-marker:hover .marker-circle {
    r: 12;
    fill: #ff4757;
    filter: drop-shadow(0 0 8px rgba(220, 53, 69, 0.6));
}

.marker-pulse {
    animation: pulse 2s ease-out infinite;
    opacity: 0;
}

.agency-marker:hover .marker-pulse {
    animation: none;
}

.agency-marker.selected .marker-circle {
    r: 14;
    fill: #28a745;
    stroke-width: 3;
    filter: drop-shadow(0 0 12px rgba(40, 167, 69, 0.8));
}

.agency-marker.selected .marker-pulse {
    animation: none;
}

@keyframes pulse {
    0% {
        r: 8;
        opacity: 1;
        stroke-width: 2;
    }
    100% {
        r: 20;
        opacity: 0;
        stroke-width: 0;
    }
}

/* Detail Panel (always visible on right) */
.agency-detail-panel {
    width: 100%;
    max-width: 400px;
    background: #ffffff;
    border-radius: var(--border-radius-lg, 16px);
    padding: 0;
    box-shadow: var(--shadow-md, 0 10px 40px rgba(0, 0, 0, 0.15));
    border: 2px solid var(--cc-primary, #2f4089);
    max-height: 680px;
    overflow-y: auto;
    position: sticky;
    top: 24px;
    display: block;
}

/* Empty state (when no agency selected) */
.detail-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 40px;
    min-height: 400px;
}

.detail-empty-state svg {
    color: #b0d4f1;
    margin-bottom: 24px;
    opacity: 0.5;
}

.detail-empty-state h4 {
    font-size: 1.4rem;
    color: #0066cc;
    font-weight: 700;
    margin: 0 0 12px 0;
}

.detail-empty-state p {
    font-size: 1rem;
    color: #666;
    margin: 0;
    line-height: 1.5;
}

/* Agency info container */
.detail-agency-info {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.detail-panel-content {
    padding: 24px;
}

.detail-title {
    font-size: var(--font-size-2xl, 1.875rem);
    color: var(--cc-primary, #2f4089);
    font-weight: var(--font-weight-semibold, 600);
    margin: 0 0 24px 0;
    line-height: 1.3;
    padding-right: 40px;
}

.detail-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.detail-section:last-of-type {
    border-bottom: none;
}

.detail-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: var(--font-weight-semibold, 600);
    color: #4c5473;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}

.detail-label svg {
    color: #0066cc;
    flex-shrink: 0;
}

.detail-value {
    color: var(--color-text, #1f233a);
    font-size: 0.95rem;
    line-height: 1.6;
    padding-left: 26px;
}

.detail-address {
    font-style: normal;
}

.detail-website-link {
    color: #0066cc;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.detail-website-link:hover {
    color: #0052a3;
    text-decoration: underline;
}

.detail-actions {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 2px solid #e3f2fd;
}

.detail-view-full-btn {
    display: block;
    background: var(--cc-primary, #2f4089);
    color: white !important;
    text-align: center;
    padding: 14px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.detail-view-full-btn:hover {
    background: var(--cc-primary-dark, #202c63);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

/* Popup/Tooltip (Simplified) */
.agency-tooltip {
    position: absolute;
    background: #ffffff;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    max-width: 280px;
    z-index: var(--z-modal);
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    border: 2px solid var(--cc-primary, #2f4089);
    opacity: 0;
}

.agency-tooltip.show {
    display: block !important;
    opacity: 1;
    transform: translateY(0);
}

.tooltip-title {
    margin: 0 0 12px 0;
    font-size: 1.05rem;
    color: var(--cc-primary, #2f4089);
    font-weight: var(--font-weight-semibold, 600);
    line-height: 1.3;
}

.tooltip-content p {
    margin: 6px 0;
    font-size: 0.85rem;
    color: #333;
    line-height: 1.5;
    display: flex;
    gap: 6px;
}

.tooltip-content strong {
    color: #666;
    font-weight: 600;
}

.tooltip-content .location-text,
.tooltip-content .counties-text {
    color: #222;
    font-weight: 500;
}

.tooltip-action {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

.tooltip-click-hint {
    color: var(--cc-primary, #2f4089);
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #e3f2fd;
    border-radius: 12px;
}

/* Agency List */
.agencies-list {
    margin-top: 60px;
}

.agencies-list h3 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 30px;
    text-align: center;
    font-weight: 700;
}

.california-map-wrapper .agencies-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    margin-top: 30px;
}

@media (max-width: 1200px) {
    .california-map-wrapper .agencies-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .california-map-wrapper .agencies-grid {
        grid-template-columns: 1fr;
    }
}

.agency-card {
    background: #ffffff;
    border-radius: var(--border-radius-lg, 12px);
    padding: 25px;
    box-shadow: var(--shadow-sm, 0 4px 15px rgba(0, 0, 0, 0.08));
    transition: all 0.3s ease;
    border: 2px solid transparent;
    cursor: pointer;
}

.agency-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md, 0 8px 25px rgba(0, 102, 204, 0.15));
    border-color: var(--cc-primary, #2f4089);
}

.agency-card h4 {
    margin: 0 0 15px 0;
    font-size: 1.2rem;
    color: #0066cc;
    font-weight: 700;
    line-height: 1.3;
}

.agency-location {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 0.95rem;
    margin: 10px 0;
}

.agency-location svg {
    color: #dc3545;
    flex-shrink: 0;
}

.agency-counties {
    color: #666;
    font-size: 0.9rem;
    margin: 10px 0;
    line-height: 1.5;
}

.agency-counties strong {
    color: #333;
}

.agency-link {
    display: inline-block;
    margin-top: 15px;
    padding: 10px 20px;
    background: var(--cc-primary, #2f4089);
    color: #ffffff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.agency-link:hover {
    background: var(--cc-primary-dark, #202c63);
    transform: translateX(5px);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .california-map-wrapper.has-detail-panel {
        grid-template-columns: minmax(0, 1fr);
    }
    
    .agency-detail-panel {
        position: relative;
        top: 0;
        max-width: 100%;
        max-height: none;
        order: initial;
    }
}

@media (max-width: 768px) {
    .california-map-container {
        padding: 20px 15px;
    }
    
    .california-map-header h2 {
        font-size: 1.8rem;
    }
    
    .map-subtitle {
        font-size: 1rem;
    }
    
    .california-map-wrapper {
        padding: 20px;
    }

    .california-map-wrapper .agencies-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .agency-tooltip {
        max-width: 280px;
        padding: 15px;
        font-size: 0.9rem;
    }
    
    .tooltip-title {
        font-size: 1.1rem;
    }
    
    .agency-detail-panel {
        max-height: 400px;
    }
    
    .detail-title {
        font-size: 1.3rem;
    }
}

/* Print Styles */
@media print {
    .agency-tooltip {
        display: none !important;
    }
    
    .california-map-wrapper {
        background: white;
        box-shadow: none;
    }
    
    .marker-pulse {
        display: none;
    }
}

