/**
 * Las Piedras - Mapa de Pontos de Venda - Frontend CSS
 * Estilos para mapa, filtros e componentes interativos
 */

/* Typography for filters */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&display=swap');

/* ========================================
   Container Principal
======================================== */
.las-piedras-mapa-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    position: relative;
}

/* ========================================
   Área de Filtros
======================================== */
.las-piedras-filtros {
    background: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 90px;
    box-shadow: none;
}

/* Make three columns harmonious (≈33.33% each) */
.filtros-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: end;
}

.filtro-grupo {
    /* exactly 1/3 accounting for the two gaps (20px each) */
    flex: 0 1 calc((100% - 40px) / 2);
    min-width: 0; /* avoid forced wrapping */
}

/* Labels in CAPS and Montserrat */
.filtro-grupo label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
    text-transform: uppercase;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Selects with custom caret and Montserrat */
.filtro-select {
    width: 100%;
    padding: 14px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    background-color: #ffffff;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    height: 48px;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 24 24' fill='none' stroke='%23AE6D21' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 20px center;
    background-size: 14px 10px;
    padding-right: 44px; /* leave room for caret */
}

.filtro-select::-ms-expand { display: none; }

.filtro-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.filtro-select:disabled {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

/* Button matches input height and is centered */
.btn-limpar {
    background: #22411B;
    color: #ffffff;
    border: none;
    height: 48px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.btn-limpar:hover {
    background: #1b3516;
    transform: translateY(-1px);
}

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

/* ========================================
   Container do Mapa
======================================== */
.las-piedras-mapa-wrapper {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.las-piedras-mapa {
    width: 100%;
    min-height: 400px;
    background: #f8f9fa;
    position: relative;
}

/* ========================================
   Indicadores de Estado
======================================== */
.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 15px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-indicator p {
    margin: 0;
    color: #2c3e50;
    font-weight: 500;
}

.map-message {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(52, 73, 94, 0.9);
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    z-index: 1000;
    font-size: 14px;
    font-weight: 500;
    max-width: 90%;
    text-align: center;
}

.las-piedras-error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
    text-align: center;
    font-weight: 500;
}

/* ========================================
   InfoWindow Customizado
======================================== */
.info-window {
    max-width: 300px;
    padding: 10px;
}

.info-window h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
}

.info-window p {
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.4;
}

.info-window em {
    color: #3498db;
    font-style: normal;
    font-weight: 500;
}

/* ========================================
   Modal
======================================== */
.las-piedras-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    position: relative;
    z-index: 10001;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    animation: modalEnter 0.3s ease-out;
}

@keyframes modalEnter {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #22411B;
}

.modal-header h3 {
    margin: 0;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.modal-close:hover {
    background: #e9ecef;
    color: #495057;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

/* ========================================
   Detalhes do PDV
======================================== */
.pdv-details {
    line-height: 1.6;
}

.detail-row {
    display: flex;
    margin-bottom: 12px;
    align-items: flex-start;
}

.detail-row .label {
    font-weight: 600;
    color: #2c3e50;
    min-width: 120px;
    margin-right: 10px;
    font-size: 14px;
}

.detail-row .value {
    color: #495057;
    font-size: 14px;
    flex: 1;
}

.detail-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e1e5e9;
    text-align: center;
}

.btn-view-map {
    background: #AE6D21;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s 
ease, transform 0.2s 
ease;
}

.btn-view-map:hover {
    background: #7C4626;
    transform: translateY(-1px);
}

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

.loading-modal {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

/* ========================================
   Lista de PDVs (quando habilitada)
======================================== */
.las-piedras-lista-pdvs {
    margin-top: 30px;
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    overflow: hidden;
}

.las-piedras-lista-pdvs h3 {
    margin: 0;
    padding: 20px;
    background: #f8f9fa;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 1px solid #e1e5e9;
}

.lista-pdvs-content {
    max-height: 400px;
    overflow-y: auto;
}

.pdv-item {
    padding: 15px 20px;
    border-bottom: 1px solid #f1f3f4;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.pdv-item:hover {
    background: #f8f9fa;
}

.pdv-item:last-child {
    border-bottom: none;
}

.pdv-item h4 {
    margin: 0 0 8px 0;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
}

.pdv-item p {
    margin: 4px 0;
    color: #6c757d;
    font-size: 14px;
}

/* ========================================
   Responsividade
======================================== */
@media (max-width: 768px) {
    .filtros-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .filtro-grupo {
        min-width: auto;
    }
    
    .las-piedras-mapa {
        min-height: 300px;
    }
    
    .modal-content {
        margin: 10px;
        max-height: 90vh;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-body {
        padding: 15px;
        max-height: 70vh;
    }
    
    .detail-row {
        flex-direction: column;
        margin-bottom: 15px;
    }
    
    .detail-row .label {
        min-width: auto;
        margin-bottom: 4px;
        margin-right: 0;
    }
    
    .info-window {
        max-width: 250px;
    }
}

@media (max-width: 480px) {
    .las-piedras-filtros {
        padding: 15px;
    }
    
    .filtro-select,
    .btn-limpar {
        padding: 8px 12px;
    }
    
    .las-piedras-mapa {
        min-height: 250px;
    }
    
    .modal-content {
        margin: 5px;
    }
} 

/* Layout container for filters row constraints */
.las-piedras-mapa-container .las-piedras-filtros {
    width: 80%;
    max-width: 1360px;
    margin-left: auto;
    margin-right: auto;
}

/* Button visual update to match request */
.btn-limpar {
    background: #22411B;
    color: #ffffff;
    border: none;
    padding: 14px 22px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.btn-limpar:hover {
    background: #1b3516;
    transform: translateY(-1px);
}

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

/* Ensure map area uses full width of its container */
.las-piedras-mapa-wrapper,
.las-piedras-mapa {
    width: 100%;
}

/* Tweak selects to align with button height */
.filtro-select {
    padding: 14px 12px;
    border-radius: 8px;
}

/* Responsive: keep filters nicely centered */
@media (max-width: 1360px) {
    .las-piedras-mapa-container .las-piedras-filtros {
        width: 90%;
    }
} 

@media (max-width: 1024px) {
    .filtros-row { flex-direction: column; gap: 15px; }
    .filtros-row .filtro-grupo { flex: 1 1 100%; }
} 

@media (max-width: 768px) {
    .las-piedras-mapa-container .las-piedras-filtros {
        width: 100%;
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }
    .filtro-grupo {
        width: 100%;
    }
} 