@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap');

:root {
    --primary-color: #0077b6;
    --secondary-color: #004e89;
    --tercero: #9b2226;
    --background-color: #f0f0f0;
    --morado: #6a4c93;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Open Sans', sans-serif;
    background-color: var(--background-color);
    font-size: 1rem;
    font-weight: normal;
    margin: 0;
    padding: 0;
}

#map_canvas {
    z-index: 0;
    position: fixed;
    top: 0px;
    left: 0px;
    right: 0px;
    bottom: 0px;
}

/* Estilos para invertir colores del mapa (modo oscuro) */
.estilos-invertidos {
    filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}

#zoom-in {
    position: absolute;
    top: 140px;
    right: 90px;
    z-index: 101;
    background-color: #e9c46a;
    border-radius: 5px;
    vertical-align: middle;
    text-align: center;
    width: 48px;
    height: 40px;
    cursor: pointer;
    font-weight: bold;
    color: #000000;
    font-size: 24px;
}

#zoom-out {
    position: absolute;
    top: 140px;
    right: 30px;
    z-index: 101;
    background-color: #e9c46a;
    border-radius: 5px;
    vertical-align: middle;
    text-align: center;
    width: 48px;
    height: 40px;
    cursor: pointer;
    font-weight: bold;
    color: #000000;
    font-size: 24px;
}

#logo_container {
    position: absolute;
    left: 10px;
    top: 10px;
    padding: 10px;
    z-index: 100;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    opacity: 0.9;
    text-align: center;
    color: var(--secondary-color);
    font-size: 0.8rem;
    padding-bottom: 10px;
}

.leaflet-control-attribution {
    position: fixed;
    bottom: 30px !important;
    left: 1px !important;
    z-index: 1000 !important;
}

.leaflet-control-scale {
    position: fixed;
    bottom: 140px !important;
    right: 1px !important;
    text-align: right !important;
}

#wait {
    width: 256px;
    height: 256px;
    top: calc(50% - 125px);
    left: calc(50% - 125px);
    position: absolute;
    z-index: 1000000;
}

#options {
    background-color: var(--secondary-color);
    position: absolute;
    right: 10px;
    top: 70px;
    z-index: 100;
    padding: 5px 10px;
    border-bottom-width: 1px;
    border-bottom-style: solid;
    border-bottom-color: var(--primary-color);
    font-size: 0.8rem;
    width: 150px;
    text-align: center;
}

#status {
    font-size: 14px !important;
    padding: 3px;
    position: absolute;
    bottom: 0px;
    z-index: 1000;
    text-align: center;
    color: #ffffff;
    background-color: var(--morado);
    margin-left: auto;
    margin-right: auto;
    left: 0px;
    right: 0px;
}

#casos1 {
    font-size: 14px !important;
    padding: 5px;
    position: absolute;
    top: 100px;
    right: 10px;
    z-index: 1000;
    text-align: center;
    color: white;
    background-color: var(--primary-color);
    width: 150px;
}

#recargar {
    position: absolute;
    bottom: 240px;
    z-index: 1000;
    text-align: center;
    left: 10px;
    height: 64px;
    width: 64px;
    border-radius: 10px;
    background-color: var(--secondary-color);
    cursor: pointer;
}

#claro_oscuro {
    padding-top: 7px;
    bottom: 150px;
    left: 10px;
    position: absolute;
    z-index: 1000;
    text-align: center;
    height: 64px;
    width: 64px;
    border-radius: 10px;
    background-color: var(--secondary-color);
    cursor: pointer;
}

.leaflet-control-zoom {
    display: none;
}

/* evita el cuadrado negro onclick (foco por defecto en los elementos SVG de los círculos del mapa) */
g:focus {
    outline: none;
}

path:focus {
    outline: none;
}

.leaflet-container path:focus,
.leaflet-container svg:focus,
.leaflet-interactive:focus {
    outline: none !important;
}
/* evita el cuadrado negro onclick*/

#location {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: absolute;
    bottom: 60px;
    left: 10px;
    z-index: 1000;
    color: black;
    height: 64px;
    width: 64px;
    border-radius: 10px;
    background-color: var(--secondary-color);
    cursor: pointer;
    padding-top: 10px;
}

#ampolleta {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: absolute;
    bottom: 60px;
    right: 10px;
    z-index: 1000;
    color: black;
    height: 64px;
    width: 64px;
    border-radius: 10px;
    background-color: var(--secondary-color);
    padding-top: 12px;
    cursor: pointer;
    transition: all 1s ease-in-out;
}

#nuevo {
    position: absolute;
    bottom: 150px;
    z-index: 1000;
    text-align: center;
    right: 10px;
    height: 64px;
    width: 64px;
    border-radius: 10px;
    background-color: var(--tercero);
}

.tools {
    color: #000000;
    text-decoration: none;
    margin-right: 0px;
}
a.tools:link,
a.tools:active,
a.tools:visited {
    color: #fff;
    text-decoration: none;
}
a.tools:hover {
    color: #fff;
    text-decoration: underline;
}

/* scrollbar */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
::-webkit-scrollbar-track {
    background: #f0f0f0;
}
::-webkit-scrollbar-thumb {
    background: #9aa5b1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #7a8492;
}

html {
    scrollbar-width: thin;
    scrollbar-color: #9aa5b1 #f0f0f0;
}

/* -------- panel lateral deslizante (usado por "nuevo reporte" y la ficha de detalle) -------- */

.panel-lateral {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 100%;
    height: 100%;
    z-index: 100000;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    box-shadow: -6px 0 32px rgba(0, 0, 0, 0.22);
    border-left: 1px solid rgba(0, 0, 0, 0.08);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--secondary-color);
    color: white;
    padding: 12px 16px;
    flex-shrink: 0;
    min-height: 52px;
    font-weight: 600;
}
.panel-header a.panel-cerrar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-size: 16px;
    text-decoration: none;
}
.panel-header a.panel-cerrar-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.container-report {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    background: white;
}

.form-label {
    color: #333;
    margin-bottom: 6px;
    display: block;
    font-weight: 600;
}

.form-control {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 12px;
    width: 100%;
}
.form-control:focus {
    outline: none;
    border-color: #666;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.mb-3 {
    margin-bottom: 20px;
}

.name-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.photo-section {
    margin-bottom: 24px;
}
.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 12px;
}
.photo-slot {
    aspect-ratio: 1;
    border: 2px dashed #e0e0e0;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: #fafafa;
    position: relative;
    overflow: hidden;
}
.photo-slot i {
    font-size: 24px;
    color: #999;
    margin-bottom: 4px;
}
.photo-slot span {
    font-size: 11px;
    color: #999;
    font-weight: 500;
}
.photo-slot.has-image {
    border-style: solid;
    border-color: #0077b6;
}
.photo-slot.procesando {
    opacity: 0.6;
}
.photo-slot.has-image i,
.photo-slot.has-image span {
    display: none;
}
.photo-slot img.preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
input[type="file"] {
    display: none;
}

.campo-hint {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
    min-height: 16px;
}

#reporte_msg {
    font-size: 14px;
    margin-bottom: 10px;
}
#reporte_msg.ok {
    color: #147a3d;
}
#reporte_msg.ok i {
    margin-right: 6px;
}
#reporte_msg.error {
    color: #c1121f;
}

/* ===== Overlays de envío: cargando / éxito / error ===== */
.report-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 24, 30, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200000;
    padding: 20px;
    text-align: center;
}

.overlay-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 36px 28px;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.overlay-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 18px 0 8px;
    color: #1a1a1a;
}

.overlay-hint {
    font-size: 1rem;
    color: #555;
    margin: 0 0 4px;
}

.spinner {
    width: 64px;
    height: 64px;
    margin: 0 auto;
    border: 6px solid #e0e0e0;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.progress-bar-wrap {
    width: 100%;
    height: 18px;
    background: #e9ecef;
    border-radius: 999px;
    overflow: hidden;
    margin: 18px 0 8px;
    border: 1px solid #d5d9de;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #0077b6, #3d8bfd);
    border-radius: 999px;
    transition: width 0.25s ease;
}

.progress-percent {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 10px;
}

.success-icon {
    width: 76px;
    height: 76px;
    margin: 0 auto;
    border-radius: 50%;
    background: #198754;
    color: #fff;
    font-size: 2.4rem;
    line-height: 76px;
    animation: pop-in 0.35s ease;
}

.error-icon {
    width: 76px;
    height: 76px;
    margin: 0 auto;
    border-radius: 50%;
    background: #dc3545;
    color: #fff;
    font-size: 2.4rem;
    line-height: 76px;
    animation: pop-in 0.35s ease;
}

@keyframes pop-in {
    0% { transform: scale(0.4); opacity: 0; }
    70% { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); }
}

.overlay-card .btn-submit {
    margin-top: 22px;
    width: 100%;
    font-size: 1.1rem;
    padding: 14px 0;
}

.btn-submit {
    width: 100%;
    padding: 14px;
    background: #000;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 8px;
}

@media (max-width: 480px) {
    .panel-lateral {
        width: 100% !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 92dvh;
        border-left: none;
        border-top-left-radius: 18px;
        border-top-right-radius: 18px;
    }
    .panel-header {
        border-top-left-radius: 18px;
        border-top-right-radius: 18px;
    }
}

/* -------- búsqueda (solo GUI) -------- */

#divsearch {
    height: 38px;
    padding: 2px;
    top: 10px;
    right: 10px;
    position: absolute;
    z-index: 10000;
    width: 200px;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
#divsearch .input-group {
    height: 100%;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
}
#divsearch .form-control {
    border: 1px solid #ddd;
    border-right: none;
    flex: 1;
    min-width: 0;
    height: 34px;
    font-size: 14px;
    padding: 5px 8px;
    border-radius: 4px 0 0 4px;
}
#divsearch .btn-dark {
    background-color: var(--primary-color) !important;
    border: 1px solid var(--primary-color) !important;
    flex-shrink: 0;
    width: 38px;
    height: 34px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 4px 4px 0;
}

/* Responsive */
@media (max-width: 768px) {
    #divsearch {
        width: 140px;
        height: 36px;
    }
    #divsearch .form-control {
        font-size: 13px;
        padding: 4px 6px;
        height: 32px;
    }
    #divsearch .btn-dark {
        width: 36px;
        height: 32px;
    }
    #logo_container img {
        width: 55px;
    }
}

@media (max-width: 480px) {
    #divsearch {
        width: 130px;
        height: 34px;
    }
    #logo_container {
        font-size: 0.65rem;
        padding: 6px;
        left: 8px;
        top: 8px;
    }
    #logo_container img {
        width: 45px;
    }
}

@media (max-width: 375px) {
    #divsearch {
        width: 115px;
    }
}

/* -------- ficha de detalle del reporte (carrusel + campos), portado de detalle.html -------- */

.report-image {
    width: 100%;
    height: 280px;
    object-fit: cover;
    display: block;
}

.ficha-carousel {
    background: #f5f5f5;
}

.ficha-carousel .carousel-control-prev,
.ficha-carousel .carousel-control-next {
    width: 50px;
}

.no-images {
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    color: #95a5a6;
    font-size: 0.95rem;
}

.ficha-content {
    padding: 1.5rem;
}

.ficha-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1.5rem;
    line-height: 1.3;
}

.info-item {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #e0e0e0;
}
.info-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.info-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.4rem;
}

.info-value {
    font-size: 0.95rem;
    color: #2c3e50;
    line-height: 1.5;
    white-space: pre-line;
}
.info-value.muted {
    color: #95a5a6;
}
