/* =========================================
   1. GENERAL RESETS Y BASE
   ========================================= */
body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    background-color: #ffffff;
    color: #333;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: #007bff;
}

* {
    box-sizing: border-box;
}

/* =========================================
   2. HEADER (ENCABEZADO)
   ========================================= */
.header {
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.header-content-wrapper {
    max-width: 1050px; 
    margin: 0 auto; 
    padding: 0 20px; 
    width: 100%;
}

.header-top {
    background-color: #b71c1c; /* Rojo distintivo */
    padding: 12px 20px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.header-separator {
    width: 1px;
    height: 35px; 
    background-color: white;
    margin: 0 15px; 
    flex-shrink: 0; 
}

.gob-logo-consolidado {
    width: 150px; 
    height: auto; 
    display: block;
}

.logo-container {
    display: flex;
    flex-direction: row; 
    align-items: center; 
}

.platform-title {
    color: #fff;
    font-size: 0.9em;
    font-weight: 600;
    text-align: left; 
    margin-right: 0; 
    margin-top: 0; 
}

/* --- Breadcrumbs (Migas de pan) --- */
.breadcrumb-nav {
    background-color: #eff0f4;
    padding: 10px 0px;
    border-top: 1px solid #eee;
}

.breadcrumb-links {
    max-width: 1050px; 
    margin: 0 auto; 
    padding: 0 20px; 
}

.breadcrumb-links a {
    color: #0007e8; 
    font-size: 0.90em;
    font-weight: 700; 
}

.breadcrumb-links span {
    font-weight: 700; 
    color: #010104; 
    font-size: 0.90em;
}

.breadcrumb-links a:hover {
    text-decoration: underline;
}

.breadcrumb-separator-img {
    height: 15px; 
    width: auto; 
    margin: 0 5px; 
    vertical-align: middle;
}

/* =========================================
   3. CONTENIDO PRINCIPAL (LAYOUT)
   ========================================= */
.main-content {
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center; 
    min-height: calc(100vh - 120px);
}

.card-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 1050px;
}

/* Estilos Generales de las Tarjetas (Cards) */
.card {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 30px;
    box-shadow: 0.1px 2px 1px rgba(0,0,0,0.20);
}

.card-title {
    font-size: 1.5em;
    font-weight: 400;
    margin-top: 0;
    margin-bottom: 15px;
    color: #01020a;
    text-align: center;
}

.card-description {
    font-size: 0.9em;
    color: #030101;
    margin-top: 20px; 
    margin-bottom: 30px;
    max-width: 60%;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

/* =========================================
   4. FORMULARIOS E INPUTS
   ========================================= */
.form-group {
    margin-bottom: 20px;
}

/* Contenedor principal Flexbox para búsqueda */
.search-container {
    max-width: 480px;
    margin: auto;
    display: flex;
    flex-direction: column;
}

/* Wrapper del Input */
.input-wrapper {
    position: relative;
    width: 100%;
}

/* Inputs de texto y Selects */
.text-input, 
.select-input {
    width: 100%;
    padding: 12px 40px 12px 10px; 
    font-size: 16px;
    border-radius: 5px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    transition: border-color 0.2s ease;
    background-color: white; 
}

.select-input {
    padding-right: 10px;
    color: #333;
}

.text-input:hover,
.select-input:hover {
    border-color: black;
}

.text-input:focus,
.select-input:focus {
    border: 2px solid #e60023; 
    outline: none;
}

/* Etiqueta Flotante (Label) */
.input-wrapper .input-label {
    position: absolute;
    top: -10px;
    left: 10px;
    color: #dc3545;
    font-size: 12px;
    background-color: white;
    padding: 0 4px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.2s ease-out;
    pointer-events: none;
    font-weight: 500;
}

/* Visibilidad de la etiqueta */
.input-wrapper .text-input:focus ~ .input-label,
.input-wrapper .text-input:valid ~ .input-label,
.input-wrapper .select-input:focus ~ .input-label,
.input-wrapper .select-input:valid ~ .input-label {
    opacity: 1;
    transform: translateY(0);
}

/* Icono Micrófono */
.input-wrapper .mic-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #555;
    cursor: pointer;
}

/* --- Toggle Switch (Búsqueda Avanzada) --- */
#toggle-wrapper {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    justify-content: center;
    order: 2;
}

#toggle-wrapper label {
    margin-left: 10px;
    font-size: 16px;
}

#simple-search {
    order: 1;
    margin-bottom: 20px;
}

#advanced-search {
    display: none;
    order: 3;
    gap: 10px;
}

.search-inputs {
    display: flex;
    align-items: flex-start;
    gap: 10px; 
}

.switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 28px; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: #dc3545; }
input:checked + .slider:before { transform: translateX(22px); }

/* =========================================
   5. CHECKBOXES Y CAPTCHA
   ========================================= */

/* Checkbox "Acepto condiciones" */
.checkbox-group {
    display: flex;
    align-items: center;
    width: 190px;
    padding: 10px 15px;
    background-color: #f9f9f9;
    justify-content: center;
    margin: 0 auto;
}

.checkbox-group input[type="checkbox"] {
    width: 22px; height: 22px; margin-right: 12px; cursor: pointer;
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    border: 2px solid #6c6c6c; border-radius: 3px; background-color: #fff; outline: none; position: relative;
}

.checkbox-group input[type="checkbox"]:checked { 
    border-color: #c70000; 
    background-color: #c70000; 
}

.checkbox-group input[type="checkbox"]:checked::before { 
    content: '\2713'; display: block; color: white; font-size: 20px; line-height: 28px; text-align: center; 
}
.checkbox-group label { 
    font-size: 16px; color: #333; cursor: pointer; user-select: none; 
}

/* Captcha "No soy un robot" */
.captcha-box {
    display: flex;
    align-items: center;
    width: 190px;
    padding: 10px 15px;
    background-color: #f9f9f9;
    border: 1px solid #c70000;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    justify-content: center;
    margin: 0 auto;
}

.captcha-box input[type="checkbox"] {
    width: 22px; height: 22px; margin-right: 12px; cursor: pointer;
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    border: 2px solid #6c6c6c; border-radius: 3px; background-color: #fff; outline: none; position: relative;
}

.captcha-box input[type="checkbox"]:checked { 
    border-color: #c70000; 
    background-color: #c70000; 
}

.captcha-box input[type="checkbox"]:checked::before { 
    content: '\2713'; display: block; color: white; font-size: 20px; line-height: 28px; text-align: center; 
}
.captcha-box label { 
    font-size: 16px; color: #333; cursor: pointer; user-select: none; 
}

.privacy-text {
    font-size: 0.9em;
    color: #000000;
    margin-bottom: 20px;
    text-align: center;
}

/* Botón Buscar */
.btn-buscar {
    background-color: #b71c1c; 
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 10px 20px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%; 
    max-width: 110px; 
    margin: 20px auto 0 auto;
    transition: background-color 0.3s ease;
}

.btn-buscar:hover {
    background-color: #8a1515; 
}

/* =========================================
   6. GRID DE OTROS SERVICIOS
   ========================================= */
.otros-servicios-card {
    text-align: center;
}

.otros-servicios-card .card-title {
    color: rgb(0, 0, 0); 
    font-weight: 300; 
    margin-bottom: 30px;
    font-size: 1.5em;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(2, 350px);
    gap: 20px;
    justify-content: center;
    max-width: 920px; 
    margin: 0 auto; 
}

.service-item {
    background-color: #e6f2f8; 
    border: 1px solid #d0e7f4;
    border-radius: 6px;
    padding: 5px 20px; 
    display: flex; 
    flex-direction: row; 
    align-items: center; 
    justify-content: space-between; 
    color: rgb(0, 66, 133); 
    font-size: 0.95em;
    font-weight: 300;
    text-align: left; 
    transition: all 0.2s ease;
    min-height: 80px; 
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.30); 
}

.service-item:hover {
    background-color: #d0e7f4; 
    border-color: #a7d3ee;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.service-item img {
    width: 80px; 
    height: 80px;
    margin-left: 5px; 
    margin-bottom: 0; 
    flex-shrink: 0; 
    filter: brightness(0) saturate(100%) invert(24%) sepia(76%) saturate(1865%) hue-rotate(206deg) brightness(89%) contrast(85%); 
}

.service-item span {
    flex-grow: 1; 
    text-align: left; 
    margin-right: 0; 
}

/* =========================================
   7. VENTANA EMERGENTE (POPUP INFO) - CORREGIDO
   ========================================= */

#openPopupButton {
    position: relative;
    bottom: 0;
    left: 0;
    padding: 10px 20px;
    background-color: #b71c1c;
    color: white;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-size: 16px;
    z-index: 999; /* Detrás del overlay */
}

/* Overlay Oscuro */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000; /* Encima de todo */
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s, opacity 0.3s ease;
    padding: 20px; /* Margen seguro en móvil */
    box-sizing: border-box;
}

.popup-overlay.active {
    visibility: visible;
    opacity: 1;
}

/* Caja Blanca Principal */
.popup-content {
    background-color: white;
    border-radius: 8px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    padding: 12px; /* Espacio blanco exterior al borde rojo */
    
    /* Flex y Altura Máxima para manejar Scroll */
    display: flex;          
    flex-direction: column; 
    max-height: 85vh;       /* Máximo 85% de la pantalla */
    position: relative;
}

/* Borde Rojo Interno */
.popup-inner-border {
    border: 2px solid #b71c1c;
    border-radius: 6px;
    
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Contiene el scroll */
    height: 100%;     
}

.popup-header {
    background-color: #b71c1c;
    color: white;
    padding: 12px 15px;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    width: 100%; 
    margin: 0; 
    flex-shrink: 0; /* No se encoge */
}

.popup-body {
    padding: 15px 20px;
    line-height: 1.5;
    color: #333;
    font-size: 13px;
    
    /* SCROLL INTERNO */
    overflow-y: auto; 
    flex-grow: 1;    
}

.popup-body p {
    text-align: justify;
    margin-top: 0;
}

.popup-body ul {
    list-style: none;
    padding-left: 10px;
    margin: 10px 0;
}

.popup-body ul li {
    margin-bottom: 12px;
    position: relative;
    padding-left: 15px;
    text-align: justify;
}

.popup-body ul li::before {
    content: "•";
    color: #333;
    position: absolute;
    left: 0;
    top: 0;
    font-weight: bold;
}

.popup-body a {
    color: #1500ff;
    text-decoration: none;
    word-break: break-all; 
}

.popup-body a:hover {
    text-decoration: underline;
}

.popup-footer {
    padding: 10px 15px;
    text-align: right;
    background-color: #fff;
    flex-shrink: 0; 
}

.popup-close-button {
    padding: 8px 25px;
    background-color: #b71c1c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    visibility: visible !important; 
    opacity: 1 !important;
}

.popup-close-button:hover {
    background-color: #8f1313;
}

/* =========================================
   8. VENTANA ERROR / VALIDACIÓN
   ========================================= */
.popup-overlay-error {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none; 
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.popup-overlay-error.active {
    display: flex;
    opacity: 1;
}

.popup-content-error {
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    text-align: center;
    padding: 24px;
    border: 1px solid #ddd;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.popup-overlay-error.active .popup-content-error {
    transform: scale(1);
}

.popup-icon-error {
    font-size: 50px; 
    color: #b71c1c; 
    border: 4px solid #b71c1c; 
    border-radius: 50%; 
    width: 75px; 
    height: 75px; 
    display: flex; 
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px; 
    background-color: transparent; 
}

.popup-title-error {
    font-size: 1.25rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 12px;
}

.popup-message-error {
    font-size: 1rem;
    color: #555;
    margin-bottom: 24px;
}

.popup-button-error {
    background-color: #b71c1c; 
    color: white;
    border: none;
    padding: 10px 30px;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.popup-button-error:hover {
    background-color: #b71c1c;
}

/* =========================================
   9. MODAL IMÁGENES (CAPTCHA)
   ========================================= */
#modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    display: none; justify-content: center; align-items: center; z-index: 1000;
}

#modal-window {
    background-color: #fff;
    border-radius: 5px;
    border: 2px solid #e50000; 
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    width: 500px; 
    overflow: hidden;
    padding: 25px; 
}

.modal-header {
    padding: 15px 0;
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
}

.modal-header h3 {
    margin: 0; font-size: 18px; color: #333; text-align: center;
}

.modal-body { padding: 0; }

.image-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 15px; 
}

.image-item {
    border: 1px solid #ddd; border-radius: 4px; cursor: pointer;
    overflow: hidden; transition: border-color 0.2s, box-shadow 0.2s;
}

.image-item:hover { border-color: #007bff; box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25); }

.image-item.selected { 
    border: 2px solid #4CAF50; 
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.5);
}

.image-item img { width: 100%; height: auto; display: block; }

#result-message {
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    color: #4CAF50; 
    margin-bottom: 15px;
    height: 25px; 
    visibility: hidden; 
}

#result-message.visible { visibility: visible; }

.modal-footer {
    padding: 15px 0 0 0; 
    text-align: right;
    background-color: #fff;
    border-top: 1px solid #ddd;
}

.close-button {
    background-color: #c70000; color: white; border: none;
    padding: 10px 15px; border-radius: 4px; cursor: pointer; font-size: 14px;
}

.close-button:hover { background-color: #a30000; }

#modal-overlay.visible { display: flex; }

/* =========================================
   10. RESPONSIVIDAD (MEDIA QUERIES)
   ========================================= */

/* Móviles (Ancho menor a 600px) */
@media (max-width: 600px) { 
    .services-grid {
        grid-template-columns: 1fr; /* Una columna */
        max-width: none; 
    }
    
    .service-item {
        font-size: 0.85em; 
    }
    
    .service-item img {
        width: 35px; 
        height: 35px;
    }

    /* Ajuste en Modal Imágenes para móvil */
    #modal-window {
        width: 95%;
        padding: 15px;
    }
    .image-grid {
        grid-template-columns: repeat(3, 1fr); /* Menos columnas de imágenes */
    }
}

/* Escritorio (Ancho mayor a 992px) */
@media (min-width: 992px) {
    .main-content {
        padding: 15px;
    }

    .card {
        padding: 40px;
    }
    .card-title {
        font-size: 1.5em;
    }
}