/* ==========================================================================
   1. Variables y Reseteo Base
   ========================================================================== */

/* Define la paleta de colores y configuraciones globales para fácil mantenimiento. */
:root {
    --verde-principal: #009739;
    --verde-claro: #8CD34A;
    --verde-medio: #56B870;
    --verde-oscuro: #024731;
    --rosa: #E6007E;
    --gris-neutro: #97999B;
    --fondo: #f0f2f5;
    --texto: #333;
    --blanco: #ffffff;
    --sombra: rgba(0, 0, 0, 0.1);
}

/* Establece estilos base para todo el documento. */
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--fondo);
    color: var(--texto);
}


/* ==========================================================================
   2. Estructura Principal y Cabecera
   ========================================================================== */

/* Contenedor principal que centra el contenido en pantallas grandes. */
.container {
    max-width: 500px;
    margin: 0 auto;
    background-color: var(--fondo);
}

/* Cabecera principal fija en la parte superior. Usa Flexbox para alinear elementos. */
.main-header {
    background-color: var(--verde-oscuro);
    color: var(--blanco);
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Título dentro de la cabecera. Crece para ocupar el espacio y se centra. */
.main-header h1 {
    flex-grow: 1;
    text-align: center;
    margin: 0;
    font-size: 1.5em;
}

/* Área de contenido principal con espaciado interno y espacio extra al final para el botón flotante. */
.content {
    padding: 20px 20px 100px 20px;
}


/* ==========================================================================
   3. Componentes Genéricos
   ========================================================================== */

/**
 * Botones y Enlaces
 */
.btn {
    display: block;
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    margin-top: 15px;
    box-sizing: border-box;
}
.btn-primary { background-color: var(--verde-principal); color: var(--blanco); }
.btn-secondary { background-color: var(--rosa); color: var(--blanco); }
.btn-neutral { background-color: var(--gris-neutro); color: var(--blanco); }

.link-back {
    display: inline-block;
    color: var(--verde-principal);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 20px;
}
.link-subtle {
    color: var(--gris-neutro);
    text-align: center;
    display: block;
    margin-top: 20px;
    cursor: pointer;
    text-decoration: underline;
}

/**
 * Tarjetas (Cards)
 */
.card {
    background-color: var(--blanco);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px var(--sombra);
    transition: transform 0.2s;
    text-decoration: none;
    color: var(--texto);
    display: block;
}
.card:hover {
    transform: translateY(-2px);
}

/**
 * Formularios y Búsqueda
 */
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-sizing: border-box;
}

.search-container {
    text-align: center;
    margin-bottom: 20px;
}
.search-input {
    width: 100%;
    max-width: 450px;
    padding: 12px 20px;
    border-radius: 25px;
    border: 1px solid #ddd;
    font-size: 1em;
    box-sizing: border-box;
}


/* ==========================================================================
   4. Componentes Específicos
   ========================================================================== */

/**
 * Pantalla de Login
 */
.login-container { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-container .card { text-align: center; }
.login-container h1 { font-size: 2.5em; margin: 0; color: var(--verde-oscuro); }
.login-container p { color: var(--gris-neutro); margin-bottom: 30px; }

/**
 * Pantalla de Inicio (Home)
 */
.welcome-text {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--texto);
    margin-bottom: 10px;
}
.assigned-card { text-align: center; padding: 10px 0; }
.assigned-card p { margin: 0 0 5px 0; font-weight: bold; font-size: 1.1em; color: var(--texto); }
.assigned-card .count { font-size: 3em; font-weight: bold; color: var(--verde-oscuro); line-height: 1; }

.summary-cards { display: flex; gap: 15px; }
.summary-link { text-decoration: none; color: inherit; flex: 1; }
.summary-card { flex: 1; text-align: center; padding: 20px; background-color: var(--blanco); border-radius: 12px; box-shadow: 0 2px 8px var(--sombra); }
.summary-card .count { font-size: 2.5em; font-weight: bold; color: var(--verde-principal); }
.summary-card .label { font-size: 0.9em; color: var(--gris-neutro); }

.progress-bar { width: 100%; background-color: #e0e0e0; border-radius: 10px; overflow: hidden; }
.progress { width: 40%; background-color: var(--verde-principal); height: 10px; border-radius: 10px; }

/**
 * Cabeceras de Navegación (con botones de retorno o salir)
 */
.btn-logout-header {
    background-color: #d9534f;
    color: var(--blanco);
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: bold;
}
.header-nav-btn {
    color: var(--blanco);
    text-decoration: none;
    font-size: 1.8em;
    line-height: 1;
    flex: 0 1 50px;
    text-align: left;
    padding-left: 15px;
}
.header-placeholder { /* Espacio vacío para balancear el título centrado */
    flex: 0 1 50px;
}

/**
 * Listas (Pendientes/Gestionados)
 */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.list-header h3 { margin: 0; }
.list-count {
    background-color: #e0e0e0;
    color: var(--texto);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
}
.list-card { display: flex; justify-content: space-between; align-items: center; border-left: 5px solid transparent; padding-left: 15px; }
.list-card--recolectado { border-left-color: var(--verde-medio); }
.list-card--no-recolectado { border-left-color: #d9534f; }

.list-card div { line-height: 1.4; }
.list-card .name { font-weight: bold; color: var(--texto); }
.list-card .address { font-size: 0.9em; color: var(--gris-neutro); }
.icon-arrow, .icon-check { font-size: 1.5em; color: var(--gris-neutro); }
.icon-check { color: var(--verde-medio); }
.icon-cross { font-size: 1.5em; color: #d9534f; font-weight: bold; }

/**
 * Pantalla Gestionar Recinto
 */
.actas-card { text-align: center; background-color: var(--verde-oscuro); color: var(--blanco); padding: 20px; }
.actas-card p { margin: 0 0 10px 0; font-size: 1.1em; opacity: 0.9; }
.actas-card .count { font-size: 3.5em; font-weight: bold; line-height: 1; }

.detail-item { display: flex; align-items: center; margin-bottom: 15px; }
.detail-item span { margin-left: 10px; }

.contact-item { display: flex; justify-content: space-between; align-items: center; }
.contact-icons { display: flex; gap: 15px; align-items: center; }
.icon-button { display: block; width: 40px; height: 40px; transition: transform 0.2s; }
.icon-button img { width: 100%; height: 100%; object-fit: contain; }
.icon-button:hover { transform: scale(1.1); }

.btn-report-novedad { background-color: transparent; color: var(--gris-neutro); font-weight: normal; padding: 10px; border: 1px solid var(--gris-neutro); }
.btn-whatsapp { background-color: #25D366; color: var(--blanco); }

/**
 * Checkbox personalizado
 */
.hidden-field { display: none; }
.checkbox-label { display: flex; align-items: center; font-weight: normal; cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: auto; margin-right: 10px; }

/**
 * Evidencias en pantalla de detalle
 */
.evidence-preview { width: 100%; max-width: 250px; border-radius: 8px; margin-top: 10px; border: 1px solid #ddd; display: block; }
.evidence-gallery { display: flex; gap: 10px; flex-wrap: wrap; }
.evidence-gallery .evidence-preview { max-width: 150px; }


/* ==========================================================================
   5. Modales
   ========================================================================== */

.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0; top: 0;
    width: 100%; height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}
.modal-content {
    background-color: var(--blanco);
    margin: auto;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 4px 15px var(--sombra);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.modal-header h2 { margin: 0; color: var(--verde-oscuro); }
.close-btn { color: var(--gris-neutro); font-size: 28px; font-weight: bold; cursor: pointer; }

/* Modal de advertencia para Reverso */
.warning-modal-content { background-color: #333; color: #f1f1f1; border-radius: 12px; }
.warning-modal-content h2 { color: #f1f1f1; font-size: 1.2em; }
.warning-modal-content p { margin: 15px 0; line-height: 1.5; font-size: 0.95em; }
.warning-modal-content .modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 25px; border-top: 1px solid #555; padding-top: 15px; }
.warning-modal-content .btn { width: auto; flex-grow: 0; padding: 10px 20px; margin-top: 0; }
.btn-confirm { background-color: #0d6efd; color: white; }
.btn-cancel { background-color: #6c757d; color: white; }


/* ==========================================================================
   6. Botón Flotante (FAB)
   ========================================================================== */

.fab-container {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99;
}
.fab {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--verde-principal);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    text-decoration: none;
    transition: transform 0.2s ease-in-out, background-color 0.2s;
}
.fab img {
    width: 32px;
    height: 32px;
}
.fab:hover {
    background-color: var(--verde-oscuro);
    transform: scale(1.05);
}