/* Council Map Plugin - Frontend Styles */

/* Map Container */
.council-map-container {
    width: 100%;
    margin: 20px 0;
}

/* Filter Bar */
.cm-filter-bar {
    background: #f8f8f8;
    padding: 0;
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
}

/* Tab Navigation */
.cm-filter-tabs {
    display: flex;
    background: #e5e5e5;
    border-bottom: 2px solid #ddd;
}

.cm-tab-button {
    flex: 1;
    padding: 15px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #666;
    transition: all 0.3s ease;
    position: relative;
}

.cm-tab-button:hover {
    background: rgba(0,0,0,0.05);
    color: #333;
}

.cm-tab-button.active {
    background: #f8f8f8;
    color: #0073aa;
}

.cm-tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #0073aa;
}

/* Tab Content */
.cm-tab-content {
    padding: 20px;
}

.cm-tab-panel {
    display: none;
}

.cm-tab-panel.active {
    display: block;
}

/* Taxonomy Filters (Tab 1) */
.cm-taxonomy-filters {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* Postcode Filters (Tab 3) */
.cm-postcode-filters {
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 20px;
    align-items: flex-end;
}

.cm-postcode-button-group {
    margin-bottom: 0;
}

/* Filter Group */
.cm-filter-group {
    display: flex;
    flex-direction: column;
}

.cm-filter-group label {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 13px;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Form Inputs */
.cm-filter-select,
.cm-search-input,
.cm-postcode-input,
.cm-radius-select {
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    width: 100%;
    font-size: 15px;
    transition: border-color 0.2s ease;
}

.cm-filter-select:focus,
.cm-search-input:focus,
.cm-postcode-input:focus,
.cm-radius-select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Button Row */
.cm-button-row {
    display: flex;
    gap: 10px;
    padding: 0 20px 20px 20px;
    border-top: 1px solid #e0e0e0;
    margin-top: 20px;
    padding-top: 20px;
}

.cm-button-row .button {
    flex: 1;
}

/* Apply primary button styling if theme doesn't */
.cm-apply-button,
.button.cm-apply-button {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

.cm-apply-button:hover,
.button.cm-apply-button:hover {
    background: #005a87;
    border-color: #005a87;
    color: #fff;
}

/* Reset button styling */
.cm-reset-button,
.button.cm-reset-button {
    background: #666;
    color: #fff;
    border-color: #666;
}

.cm-reset-button:hover,
.button.cm-reset-button:hover {
    background: #444;
    border-color: #444;
    color: #fff;
}

/* Postcode search button */
.cm-postcode-search-button,
.button.cm-postcode-search-button {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
    white-space: nowrap;
}

.cm-postcode-search-button:hover,
.button.cm-postcode-search-button:hover {
    background: #005a87;
    border-color: #005a87;
    color: #fff;
}

/* Mobile Toggle Button */
.cm-mobile-toggle {
    display: block;
    width: 100%;
    padding: 15px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 0;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.3s ease;
}

.cm-mobile-toggle:hover {
    background: #005a87;
}

.cm-mobile-toggle.active {
    background: #005a87;
}

.cm-mobile-toggle::after {
    content: ' ▼';
    font-size: 12px;
}

.cm-mobile-toggle.active::after {
    content: ' ▲';
}

/* Results Info */
.cm-results-info {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
    background: #fff;
}

.cm-results-count {
    font-size: 14px;
    color: #0073aa;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Map Wrapper */
.cm-map-wrapper {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Map Canvas */
.cm-map-canvas {
    width: 100%;
    height: 600px;
    background: #e5e3df;
}

/* Loading State */
.cm-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 1000;
}

.cm-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: cm-spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes cm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.cm-loading p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Info Window Styles */
.cm-info-window {
    max-width: 280px;
    padding: 15px;
}

.cm-info-window img {
    max-width: 100%;
    height: auto;
    margin-bottom: 10px;
    border-radius: 4px;
}

.cm-info-window h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #333;
    line-height: 1.3;
}

.cm-info-address {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
    line-height: 1.4;
}

.cm-info-link {
    display: inline-block;
    background: #0073aa;
    color: #fff !important;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.3s ease;
}

.cm-info-link:hover {
    background: #005a87;
    color: #fff !important;
}

/* Error Message */
.cm-error-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.cm-error-message p {
    margin: 0;
}

/* Responsive Styles */
@media (max-width: 992px) {
    .cm-taxonomy-filters {
        grid-template-columns: 1fr;
    }
    
    .cm-postcode-filters {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .cm-tab-button {
        padding: 12px 10px;
        font-size: 14px;
    }
    
    /* Stack tabs on mobile */
    .cm-filter-tabs {
        flex-direction: column;
    }
    
    .cm-tab-button {
        width: 100%;
        text-align: left;
        border-bottom: 1px solid #ddd;
    }
    
    .cm-tab-button.active::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 3px;
        height: 100%;
        background: #0073aa;
    }
    
    .cm-tab-content {
        padding: 15px;
    }
    
    .cm-button-row {
        padding: 0 15px 15px 15px;
        padding-top: 15px;
    }
    
    .cm-results-info {
        padding: 12px 15px;
    }
    
    .cm-map-canvas {
        height: 400px;
    }
}

@media (max-width: 576px) {
    .cm-tab-button {
        padding: 10px 8px;
        font-size: 13px;
    }
    
    .cm-tab-content {
        padding: 10px;
    }
    
    .cm-taxonomy-filters,
    .cm-postcode-filters {
        gap: 10px;
    }
    
    .cm-button-row {
        flex-direction: column;
    }
    
    .cm-map-canvas {
        height: 350px;
    }
}