:root {
    /* Identidade Igreja Atitude (Restrito à tela do mapa) */
    --primary-gold: #FF6600; /* Laranja Atitude */
    --primary-sand: #ffffff;
    --dark-bg: #f4f6f8; /* Cinza super claro de fundo */
    --glass-bg: rgba(255, 255, 255, 0.95); 
    --glass-border: rgba(0, 0, 0, 0.1);
}

/* Layout da página de mapas/videos */
body {
    background-color: var(--dark-bg);
    color: #333333;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Força a cor sólida da logo no topo pra não ter desnível de cor no fundo transparente do PNG */
.navbar.glass {
    background: #ffffff !important;
    border-bottom: 2px solid var(--primary-gold);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.map-layout {
    display: flex;
    flex-wrap: wrap;
    padding: 115px 20px 20px; /* espaco pro navbar maior */
    gap: 20px;
    height: 100vh;
    box-sizing: border-box;
}

/* Sidebar */
.sidebar {
    flex: 1;
    min-width: 330px;
    max-width: 400px;
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.sidebar h2 {
    color: var(--primary-gold);
    font-size: 1.5rem;
    margin-bottom: 10px;
    font-weight: 800;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0; /* Previne que blocos de select/input muito grandes quebrem o grid */
}

.filter-group label {
    font-size: 0.95rem;
    font-weight: 700;
    color: #555555;
}

.filter-group select, .filter-group input {
    width: 100%; /* Força os campos a respeitarem a parede do container */
    max-width: 100%;
    box-sizing: border-box;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #cccccc;
    background: #fcfcfc;
    color: #333333;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
}

.filter-group select:focus {
    border-color: var(--primary-gold);
    outline: none;
}

/* Quadro Resumo */
.summary-box {
    margin-top: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #eeeeee;
}

.summary-box h3 {
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: var(--primary-gold);
    font-weight: 700;
}

#summary-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#summary-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eeeeee;
    color: #444444; 
    cursor: pointer;
    transition: all 0.2s;
}

#summary-list li:hover {
    color: var(--primary-gold);
    background: #fff5f0;
}

#summary-list li.active {
    color: white;
    font-weight: bold;
    background: var(--primary-gold);
    padding: 10px;
    border-radius: 8px;
    border-bottom: none;
    margin: 2px 0; 
}

#summary-list li:last-child {
    border-bottom: none;
}

.badge {
    background: var(--primary-gold);
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: bold;
}

/* Área do Mapa */
.map-container-main {
    flex: 3;
    min-width: 300px;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
    /* Mobile-friendly flex structure */
    display: flex;
    flex-direction: column;
}

#map {
    width: 100%;
    flex-grow: 1; /* Pushes bottom-cards-bar down and takes all remaining space */
    min-height: 200px; 
    background: #e5e5e5;
}

/* Barra inferior de cards */
.bottom-cards-bar {
    flex-shrink: 0; /* Never collapse its own internal height logic */
    height: 280px;
    min-height: 280px;
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    gap: 15px;
    padding: 15px;
    background: #ffffff;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.05);
}

/* Custom Scrollbar for horizontal scrolling */
.bottom-cards-bar::-webkit-scrollbar {
    height: 8px;
}
.bottom-cards-bar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}
.bottom-cards-bar::-webkit-scrollbar-thumb {
    background: var(--primary-gold);
    border-radius: 4px;
}

.cell-card {
    min-width: 260px;
    max-width: 260px;
    background: #f9f9f9;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: transform 0.2s;
    font-family: 'Outfit', sans-serif;
}

.cell-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-gold);
}

.cell-card h4 {
    color: var(--primary-gold);
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    font-weight: 800;
}

.cell-card p {
    font-size: 0.85rem;
    margin: 3px 0;
    color: #555;
    line-height: 1.3;
}

.distance-badge {
    background: var(--primary-gold);
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    align-self: flex-start;
    margin-bottom: 8px;
    display: inline-block;
}

.cell-card-actions {
    margin-top: auto;
    padding-top: 10px;
}

/* Popup do Google Maps */
.gm-style-iw {
    border-radius: 8px !important;
    background: #ffffff !important;
    font-family: 'Outfit', sans-serif;
}

.gm-style-iw-tc::after {
    background: #ffffff !important;
}

/* =========================================
   NATIVE ACCORDION (Filtros no Mobile)
   ========================================= */
.filters-details summary {
    display: none; /* Hide summary button on Desktop */
}
.filters-details-content {
    display: block !important; /* Force open on Desktop */
}

/* Responsividade mobile */
@media (max-width: 768px) {
    body {
        overflow: auto !important; /* Libera a rolagem natural do site */
    }

    .map-layout {
        flex-direction: column;
        flex-wrap: nowrap;
        height: auto !important; /* Site cresce o quanto precisar */
        padding: 110px 10px 20px;
        gap: 15px;
    }
    
    .sidebar {
        min-width: 100%;
        max-width: 100%;
        max-height: none; /* Filtro expande orgânico sem scrollar a si mesmo */
        padding: 12px;
        display: flex;
        flex-direction: column;
        gap: 10px;
        overflow-y: visible;
    }
    
    .qr-container {
        display: none !important;
    }

    /* Accordion Details Styling Mobile */
    .filters-details summary {
        display: block;
        cursor: pointer;
        background: var(--primary-gold);
        color: white;
        padding: 12px;
        border-radius: 8px;
        font-weight: 800;
        text-align: center;
        list-style: none; 
    }
    .filters-details summary::-webkit-details-marker {
        display: none;
    }
    .filters-details-content {
        display: none !important; 
    }
    .filters-details[open] .filters-details-content {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-top: 10px;
        padding-bottom: 10px;
    }

    .filters-details[open] .filters-details-content .summary-box, 
    .filters-details[open] .filters-details-content > div[style*="flex"] {
        grid-column: span 2;
    }
    
    .sidebar h2 {
        font-size: 1.25rem;
    }

    .filter-group label {
        font-size: 0.8rem;
    }
    
    .filter-group select, .filter-group input {
        padding: 8px;
    }

    .map-container-main {
        min-width: 100%;
        flex-direction: column;
        display: flex;
        height: auto; 
    }

    #map {
        height: 60vh; /* Altura segura e maravilhosa para manusear no celular */
        min-height: 400px;
        flex-grow: 0; /* Impede que ele espanque o design */
        border-radius: 12px; /* Embeleza bordas */
    }

    .bottom-cards-bar {
        height: auto;
        min-height: unset;
        max-height: none;
        padding: 15px 5px;
        gap: 15px;
        overflow-x: auto; /* Retorna barra horizontal maravilhosa do iOS/Android */
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        /* Custom scrollbar to make it obvious */
        scrollbar-width: thin;
        scrollbar-color: var(--primary-gold) rgba(0,0,0,0.05);
    }

    .cell-card {
        min-width: 260px; /* Tamanho excelente para deslizar os cards (swipe) */
        max-width: 260px;
        min-height: max-content;
        height: auto;
        padding: 15px;
    }

    .cell-card h4 {
        font-size: 1.1rem;
        margin-bottom: 5px;
    }
    
    .summary-box {
        margin-top: 5px;
        padding: 10px;
    }

    #summary-list li {
        padding: 5px 0;
        font-size: 0.85rem;
    }
}

/* =========================================
   DARK THEME OVERRIDES
   ========================================= */
body.dark-theme {
    --dark-bg: #121212;
    --text-color: #e0e0e0;
    --glass-bg: rgba(30, 30, 30, 0.95);
    --glass-border: rgba(255, 255, 255, 0.1);
    background-color: var(--dark-bg);
    color: var(--text-color);
}

body.dark-theme .sidebar {
    background: #1e1e1e;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
}

body.dark-theme .navbar.glass {
    background: #1e1e1e !important;
    border-bottom: 2px solid var(--primary-gold);
}

body.dark-theme .bottom-cards-bar {
    background: #1e1e1e;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.4);
}

body.dark-theme .cell-card {
    background: #2a2a2a;
    border-color: #444;
}

body.dark-theme .cell-card p {
    color: #ccc;
}

body.dark-theme .sidebar h2, 
body.dark-theme .summary-box h3,
body.dark-theme .qr-container h3,
body.dark-theme .filter-group label,
body.dark-theme #theme-label {
    color: var(--text-color);
}

body.dark-theme .summary-box h3 {
    color: var(--primary-gold);
}

body.dark-theme .sidebar h2 {
    color: var(--primary-gold);
}

body.dark-theme .filter-group select,
body.dark-theme .filter-group input {
    background: #2a2a2a !important;
    color: #e0e0e0 !important;
    border: 1px solid #444;
}

body.dark-theme .filter-group select option {
    background: #2a2a2a;
    color: #e0e0e0;
}

body.dark-theme .summary-box {
    background: #2a2a2a;
    border: 1px solid #444;
}

body.dark-theme #summary-list li {
    color: #cccccc;
    border-bottom: 1px solid #444;
}

body.dark-theme #summary-list li:hover {
    background: #333333;
    color: var(--primary-gold);
}

body.dark-theme .qr-container {
    border-top: 1px solid #444 !important;
}

/* Popup Dark Mode do Google Maps */
/* Popup Dark Mode do Google Maps */
body.dark-theme .gm-style .gm-style-iw-c,
body.dark-theme .gm-style .gm-style-iw-d,
body.dark-theme .gm-style-iw,
body.dark-theme .gm-style-iw-c,
body.dark-theme .gm-style-iw-d {
    background-color: #1e1e1e !important;
    color: #e0e0e0 !important;
}

body.dark-theme .gm-style .gm-style-iw-tc::after,
body.dark-theme .gm-style-iw-tc::after {
    background-color: #1e1e1e !important;
}

/* Força scrollbars da popup no escuro */
body.dark-theme .gm-style-iw-d::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
body.dark-theme .gm-style-iw-d::-webkit-scrollbar-track,
body.dark-theme .gm-style-iw-d::-webkit-scrollbar-corner {
    background: #1e1e1e !important;
}
body.dark-theme .gm-style-iw-d::-webkit-scrollbar-thumb {
    background: #555 !important;
    border-radius: 4px;
}

body.dark-theme .gm-style-iw h3 {
    color: var(--primary-gold) !important;
}
body.dark-theme .gm-style-iw p {
    color: #cccccc !important;
}
body.dark-theme .gm-style-iw hr {
    border-top: 1px solid #444 !important;
}

/* Filter for close button in dark mode */
body.dark-theme .gm-ui-hover-effect {
    filter: invert(1);
}

/* Theme Switch Toggle CSS Customizations */
.theme-switch input:checked + .slider {
    background-color: var(--primary-gold) !important;
}
.theme-switch input:checked + .slider .knob {
    transform: translateX(16px);
}

/* Modificações para o Popup do Google Maps: Remove scrollbar e abre um pouco maior */
.gm-style-iw-d {
    overflow: hidden !important; 
    max-height: none !important;
}

.gm-style-iw-c {
    border-radius: 12px !important;
    max-width: 320px !important;
}

/* Botão Flutuante de Cadastro (Apenas Mobile) */
.floating-fab {
    display: none;
    position: fixed;
    bottom: 25px;
    right: 20px;
    background-color: var(--primary-gold);
    color: #ffffff !important;
    padding: 14px 24px;
    border-radius: 50px;
    font-size: 1.05rem;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(255, 102, 0, 0.4);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
}
.floating-fab:active {
    transform: scale(0.95);
}
@media (max-width: 768px) {
    .floating-fab {
        display: flex;
    }
}
