/* --- 1. ESTRUCTURA Y LIENZO [Source 115, 544] --- */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-bar {
    width: 100%;
    height: 10px;
    background-color: #2749A4; /* Azul Corporativo [Source 124] */
}

header {
    background-color: #ffffff;
    color: #000000;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #ddd;
    height: 60px;
    position: relative;
    box-sizing: border-box;
}

.logo-container {
    display: grid;
    grid-template-columns: auto 1fr auto; 
    align-items: center;
    width: 100%;
    padding: 0 20px;
    box-sizing: border-box;
}

.nav-logo {
    height: 40px !important;
    width: auto !important;
}

.titulo-centrado {
    text-align: center;
    margin: 0;
    justify-self: center;
    font-size: 20px;
    font-weight: bold;
}

#admin-btn {
    justify-self: end;
    background: none;
    border: none;
    font-size: 1.1rem;
    position: static;
    cursor: pointer;
    color: black;
}

/* --- 2. CONTENEDOR PRINCIPAL [Source 116, 539, 544] --- */
.main-container {
    display: flex;
    flex: 1;
    width: 100%;
    overflow: hidden;
}

#sidebar {
    width: 350px;
    padding: 20px;
    background-color: #f9f9f9;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

#results-header {
    margin-bottom: 15px;
    display: block; /* Cambiado de flex a block para permitir saltos de línea */
}

/* CORRECCIÓN: Estilo de píldora para el contador animado [Source 124, 523] */
.contador-badge {
    background-color: #2749A4;
    color: white;
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: bold;
    display: inline-block;
    min-width: 30px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    animation: fadeInScale 0.5s ease-out; /* Animación de entrada */
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

#lista-opticas-scroll {
    flex-grow: 1;
    overflow-y: auto;
}

#map {
    flex-grow: 1;
    height: 100%;
    z-index: 0;
}

/* --- 3. PANEL ADMINISTRATIVO FLOTANTE [Source 118, 513, 543] --- */
#admin-panel {
    position: fixed;
    top: 75px;                  
    right: 20px;
    z-index: 2000;
    width: 300px;
    background: #ffffff;
    border: 1px solid #ccc;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 20px;
    border-radius: 8px;
    box-sizing: border-box;
    max-height: calc(100vh - 100px); 
    overflow-y: auto;                
}

#admin-panel::-webkit-scrollbar { width: 6px; }
#admin-panel::-webkit-scrollbar-thumb { background: #ccc; border-radius: 10px; }

.login-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

/* --- ESTILOS VER CONTRASEÑA [Source 294, 513] --- */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    padding-right: 35px !important;
}

.toggle-password {
    position: absolute;
    right: 10px;
    cursor: pointer;
    color: #999;
    font-size: 14px;
}

.toggle-password:hover {
    color: #2749A4;
}

#submit-login-btn {
    width: 100%;
    padding: 10px;
    background-color: #2749A4;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
}

/* --- 4. MODAL Y GESTIÓN [Source 29, 178] --- */
.modal {
    position: fixed; z-index: 3000; left: 0; top: 0;
    width: 100%; height: 100%; background-color: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
}

.modal-content {
    background: white; padding: 30px;
    width: 600px; border-radius: 12px; box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    max-height: 90vh; overflow-y: auto;
}

.form-grid {
    display: flex; flex-direction: column; gap: 10px;
}

.form-grid > div {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}

.form-grid label {
    flex: 0 0 150px; font-weight: bold;
}

.form-grid input {
    flex: 1; padding: 8px; box-sizing: border-box;
}

/* --- 5. RESPONSIVO [Source 659, 660] --- */
@media (max-width: 600px) {
    .main-container { flex-direction: column; height: calc(100vh - 60px); }
    #sidebar { width: 100%; height: 50vh; order: 1; }
    #map { height: 50vh; order: 2; }
    .nav-logo { width: 70px !important; }
    .titulo-centrado { font-size: 1.1rem; }
}