/**
 * OFFERS-MAP.CSS - CZYSTE STYLE MAPY OFERT
 */

/* Variables są ładowane przez functions.php jako zależność */

/* ==========================================
   🗺️ MAPA - PODSTAWOWE STYLE
   ========================================== */

.portal-map-section {
    background: var(--bg-card);
    border-radius: var(--radius-card); /* 12px - Shape & Sizing System v4.0 (deprecated fix) */
    box-shadow: var(--shadow-sm);
    margin-bottom: 30px;
    overflow: hidden;
    transition: var(--transition);
    position: relative;
    z-index: 1;
    border: 1px solid var(--border-color);
}

.portal-map-section:hover {
    box-shadow: var(--shadow-md);
}

/* ==========================================
   🎯 NAGŁÓWEK MAPY
   ========================================== */

.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px; /* Custom - Map header (wider horizontal for controls) */
    background: var(--primary-gradient);
    color: white;
    position: relative;
    z-index: 2;
}

/* Pasek dekoracyjny usunięty - nie był potrzebny i powodował problemy z gradientem */
.map-header::after {
    display: none;
}

.map-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.map-header h2::before {
    content: '🗺️';
    font-size: 28px;
}

/* ==========================================
   🔘 AKCJE MAPY
   ========================================== */

.map-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-toggle-map {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 10px 18px;
    border-radius: 25px; /* Custom - large pill shape */
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(5px);
}

.btn-toggle-map:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-toggle-map:active {
    transform: translateY(0);
}

.offers-count {
    font-size: 14px;
    opacity: 1;
    color: white;
    padding: var(--badge-padding-md); /* 6px 12px */
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px; /* Custom - pill shape */
    backdrop-filter: blur(5px);
    font-weight: 600;
}

/* ==========================================
   🎛️ KONTROLKI MAPY
   ========================================== */

.map-controls {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: center;
    padding: var(--card-padding-md); /* 20px - Shape & Sizing System v4.0 */
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.map-controls-left,
.map-controls-center,
.map-controls-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.map-controls-center {
    justify-content: center;
}

.map-controls-right {
    justify-content: flex-end;
}

.map-controls-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: var(--transition);
}

.checkbox-label:hover {
    color: var(--accent-color);
}

.checkbox-box {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-radius: 3px; /* Custom - tiny element (poniżej systemu) */
    background: var(--bg-input);
    position: relative;
    transition: var(--transition);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-box {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-box::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 10px;
    font-weight: bold;
}

.control-help {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

.area-mode-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: var(--btn-padding-sm) /* 8px 16px - Shape & Sizing System v5.0 */;
    border-radius: var(--radius-button); /* 8px - Shape & Sizing System v4.0 (deprecated fix) */
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.area-mode-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

/* ==========================================
   🗺️ KONTENER MAPY
   ========================================== */

.offers-map-container {
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    position: relative;
}

#offers-map {
    width: 100%;
    height: 600px;
    z-index: 1;
    position: relative;
    min-height: 500px;
}

.leaflet-container {
    width: 100%;
    height: 600px;
    max-width: 100%;
    z-index: 1;
    font-family: inherit;
}

/* ==========================================
   🎨 LOADING I SPINNERS
   ========================================== */

.map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-secondary);
    z-index: 10;
}

.map-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: var(--radius-full); /* 50% - Shape & Sizing System v4.0 */
    animation: spin 1s linear infinite;
    margin: 0 auto 15px auto;
}

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

.map-loading p {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
}
/* ==========================================
   📱 RESPONSIVE DESIGN
   ========================================== */

@media (max-width: 1200px) {
    .portal-offers-content {
        grid-template-columns: 280px 1fr;
        gap: 20px;
    }
    
    .portal-filters-sidebar {
        max-width: 280px;
    }
    
    .map-controls {
        grid-template-columns: 1fr;
        gap: 15px;
        text-align: center;
    }
    
    .map-controls-left,
    .map-controls-center,
    .map-controls-right {
        justify-content: center;
    }
}

@media (max-width: 1024px) {
    .portal-offers-content {
        grid-template-columns: 260px 1fr;
        gap: 20px;
    }
    
    .portal-filters-sidebar {
        position: static;
        max-width: 260px;
    }
}

@media (max-width: 768px) {
    .portal-offers-content {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0; /* Pełna szerokość - bez marginesów */
    }
    
    .portal-filters-sidebar {
        margin-bottom: 20px;
        order: -1;
        position: static;
        max-width: 100%;
    }
    
    .map-header {
        padding: 15px 20px;
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .map-actions {
        width: 100%;
        justify-content: center;
    }
    
    .map-controls {
        grid-template-columns: 1fr;
        padding: var(--input-padding-x); /* 15px - Shape & Sizing System v4.0 */
        gap: 15px;
    }

    .btn-toggle-map {
        width: 100%;
        max-width: 200px;
    }
    
    #offers-map {
        min-height: 400px;
    }
}

@media (max-width: 480px) {
    .map-header {
        padding: 12px 15px;
    }
    
    .map-header h2 {
        font-size: 20px;
    }
    
    .map-controls {
        padding: 12px;
        gap: 12px;
    }
    
    .filter-save-content {
        padding: var(--card-padding-md); /* 20px - Shape & Sizing System v4.0 */
        margin: 20px;
    }
    
    #offers-map {
        min-height: 350px;
    }
}

/* ==========================================
   🌙 DARK MODE OVERRIDES
   ========================================== */

/* .portal-map-section dark mode moved to dark-mode.css (eliminacja duplikacji) */

html[data-theme="dark"] .map-controls {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

html[data-theme="dark"] .offers-map-container {
    background: var(--bg-dark);
}

html[data-theme="dark"] .leaflet-container {
    filter: brightness(0.9) contrast(1.1);
}

/* ==========================================
   📋 UWAGA: PANEL BOCZNY
   ========================================== */
/* Style panelu bocznego (.offer-side-panel, .panel-header, .panel-content) 
   są w offers-base.css aby uniknąć konfliktów z layoutem */