/**
 * GTA Regions Filter CSS - RESO v4.0 Compliant & SearchingInToronto_IDX Integration
 * File: gta-regions-filter.css
 * Purpose: Styling for Greater Toronto Area regional filtering (Peel, York, Durham, Halton)
 * Integration: Works with gta-regions-filter.php and gta-regions-filter.js
 * RESO Compliance: Supports verified fields - City, StateOrProvince, PostalCode
 * VERIFIED: Optimized for TRREB MLS property display
 */

/* ==================================================
   GTA REGIONS FILTER CONTAINER
   ================================================== */

.gta-regions-filter-container {
    width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-sizing: border-box;
}

.gta-regions-filter-container * {
    box-sizing: border-box;
}

/* ==================================================
   BASE FILTER CONTAINER STYLING
   ================================================== */

.filter-container-base.gta-regions-filters {
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    margin-bottom: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
}

.filter-container-base.gta-regions-filters:hover {
    border-color: #0073aa;
    box-shadow: 0 4px 8px rgba(0, 115, 170, 0.15);
}

/* ==================================================
   FILTER HEADER
   ================================================== */

.filter-header-base {
    background: linear-gradient(135deg, #0073aa 0%, #005177 100%);
    color: #ffffff;
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background 0.3s ease;
}

.filter-header-base:hover {
    background: linear-gradient(135deg, #005177 0%, #003d5c 100%);
}

.filter-header-base h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.filter-toggle {
    font-size: 14px;
    font-weight: bold;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.filter-toggle:hover {
    transform: scale(1.1);
}

/* ==================================================
   FILTER CONTENT
   ================================================== */

.filter-content-base {
    padding: 20px;
    background: #fafbfc;
    border-top: 1px solid #e1e5e9;
}

/* ==================================================
   QUICK ACTIONS
   ================================================== */

.gta-quick-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.gta-quick-actions button {
    padding: 8px 16px;
    border: 1px solid #0073aa;
    background: #ffffff;
    color: #0073aa;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.gta-quick-actions button:hover {
    background: #0073aa;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 115, 170, 0.3);
}

.gta-quick-actions button:active {
    transform: translateY(0);
}

/* ==================================================
   GTA REGIONS GRID
   ================================================== */

.gta-regions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

/* ==================================================
   REGION GROUPS
   ================================================== */

.gta-region-group {
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.gta-region-group:hover {
    border-color: #0073aa;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.1);
}

.gta-region-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 12px 16px;
    border-bottom: 1px solid #e1e5e9;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background 0.3s ease;
}

.gta-region-header:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

.gta-region-header h5 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    letter-spacing: 0.3px;
}

.region-toggle {
    font-size: 12px;
    color: #6c757d;
    transition: all 0.3s ease;
}

.region-toggle:hover {
    color: #0073aa;
    transform: scale(1.1);
}

/* ==================================================
   MUNICIPALITIES LIST
   ================================================== */

.gta-municipalities-list {
    padding: 12px;
    background: #ffffff;
    max-height: 200px;
    overflow-y: auto;
    display: block;
}

.gta-municipalities-list::-webkit-scrollbar {
    width: 6px;
}

.gta-municipalities-list::-webkit-scrollbar-track {
    background: #f1f3f4;
    border-radius: 3px;
}

.gta-municipalities-list::-webkit-scrollbar-thumb {
    background: #c1c8cd;
    border-radius: 3px;
}

.gta-municipalities-list::-webkit-scrollbar-thumb:hover {
    background: #0073aa;
}

/* ==================================================
   MUNICIPALITY ITEMS
   ================================================== */

.gta-municipality-item {
    margin-bottom: 8px;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.gta-municipality-item:hover {
    background: #f8f9fa;
}

.gta-municipality-item:last-child {
    margin-bottom: 0;
}

.gta-municipality-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #2c3e50;
    margin: 0;
    line-height: 1.4;
}

.gta-municipality-checkbox {
    margin-right: 10px;
    width: 16px;
    height: 16px;
    accent-color: #0073aa;
    cursor: pointer;
}

.gta-municipality-name {
    flex-grow: 1;
    transition: color 0.2s ease;
}

.gta-municipality-checkbox:checked + .gta-municipality-name {
    color: #0073aa;
    font-weight: 600;
}

/* ==================================================
   POSTAL CODES PREVIEW
   ================================================== */

.postal-codes-preview {
    margin-top: 4px;
    padding-left: 26px;
}

.postal-codes-preview small {
    color: #6c757d;
    font-size: 11px;
    line-height: 1.3;
    display: block;
}

/* ==================================================
   FILTER ACTIONS
   ================================================== */

.gta-filter-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #0073aa 0%, #005177 100%);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 115, 170, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #005177 0%, #003d5c 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 115, 170, 0.4);
}

.btn-secondary {
    background: #ffffff;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.btn-secondary:hover {
    background: #f8f9fa;
    color: #495057;
    border-color: #adb5bd;
    transform: translateY(-1px);
}

.btn-primary:active,
.btn-secondary:active {
    transform: translateY(0);
}

/* ==================================================
   SELECTION SUMMARY
   ================================================== */

.gta-selection-summary {
    padding: 12px 16px;
    background: linear-gradient(135deg, #e8f4f8 0%, #d1ecf1 100%);
    border: 1px solid #bee5eb;
    border-radius: 4px;
    text-align: center;
}

#gta-selected-count {
    font-size: 13px;
    font-weight: 600;
    color: #0c5460;
    letter-spacing: 0.3px;
}

/* ==================================================
   LOADING & STATUS STATES
   ================================================== */

.gta-regions-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.gta-regions-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: gtaSpinner 1s linear infinite;
}

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

.gta-error-message {
    padding: 12px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 12px;
}

.gta-success-message {
    padding: 12px;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 12px;
}

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

@media (max-width: 768px) {
    .gta-regions-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .gta-quick-actions,
    .gta-filter-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .gta-quick-actions button,
    .btn-primary,
    .btn-secondary {
        width: 100%;
        text-align: center;
    }
    
    .filter-header-base {
        padding: 12px 16px;
    }
    
    .filter-content-base {
        padding: 16px;
    }
    
    .gta-municipality-label {
        font-size: 14px;
    }
    
    .gta-municipalities-list {
        max-height: 150px;
    }
}

@media (max-width: 480px) {
    .gta-regions-filter-container {
        margin: 16px 0;
    }
    
    .filter-header-base h4 {
        font-size: 14px;
    }
    
    .filter-content-base {
        padding: 12px;
    }
    
    .gta-region-header {
        padding: 10px 12px;
    }
    
    .gta-region-header h5 {
        font-size: 13px;
    }
    
    .gta-municipality-item {
        padding: 6px;
    }
    
    .gta-municipality-label {
        font-size: 13px;
    }
    
    .btn-primary,
    .btn-secondary {
        padding: 8px 16px;
        font-size: 13px;
    }
}

/* ==================================================
   INTEGRATION STYLES
   ================================================== */

/* Integration with main SearchingInToronto IDX plugin */
.searchingintoronto-search-form .gta-regions-filter-container {
    margin: 16px 0;
    order: 3; /* Position after price and basic filters */
}

/* Integration with map components */
.property-map-container + .gta-regions-filter-container {
    margin-top: 24px;
}

/* Integration with results display */
.gta-filter-active .search-results-header::before {
    content: "GTA Regions Filter Active • ";
    color: #0073aa;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==================================================
   ACCESSIBILITY IMPROVEMENTS
   ================================================== */

.gta-municipality-checkbox:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.btn-primary:focus,
.btn-secondary:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.filter-header-base:focus {
    outline: 2px solid #ffffff;
    outline-offset: -2px;
}

.gta-region-header:focus {
    outline: 2px solid #0073aa;
    outline-offset: -2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .filter-container-base.gta-regions-filters {
        border-color: #000000;
        border-width: 2px;
    }
    
    .gta-municipality-checkbox {
        border: 2px solid #000000;
    }
    
    .btn-primary,
    .btn-secondary {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .filter-container-base.gta-regions-filters,
    .gta-region-group,
    .gta-municipality-item,
    .btn-primary,
    .btn-secondary,
    .filter-toggle,
    .region-toggle {
        transition: none;
    }
    
    @keyframes gtaSpinner {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }
}

/* ==================================================
   PRINT STYLES
   ================================================== */

@media print {
    .gta-regions-filter-container {
        break-inside: avoid;
        background: #ffffff !important;
        border: 1px solid #000000;
        box-shadow: none;
    }
    
    .filter-header-base {
        background: #f0f0f0 !important;
        color: #000000 !important;
    }
    
    .gta-quick-actions,
    .gta-filter-actions {
        display: none;
    }
    
    .gta-municipalities-list {
        max-height: none;
        overflow: visible;
    }
}

/* ==================================================
   RESO COMPLIANCE INDICATORS
   ================================================== */

.gta-regions-filter-container::after {
    content: "RESO v4.0 Compliant";
    position: absolute;
    top: -8px;
    right: 8px;
    background: #28a745;
    color: #ffffff;
    font-size: 9px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
    display: none; /* Show only in development/testing */
}

/* Show RESO indicator in development */
.gta-debug .gta-regions-filter-container::after {
    display: block;
}