:root {
    --simit-blue: #007bff;
    --simit-yellow: #ffc107;
    --simit-red: #dc3545;
    --text-dark: #212529;
    --bg-light: #f4f7f6;
    --bg-light-gray: #f2f2f2;
    --color-progress-fill-light: #4c9aff; 
    --color-progress-fill-dark: var(--simit-blue); 
    --color-progress-text: var(--text-dark); 
}

body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-light); 
    display: flex;
    justify-content: center;
    align-items: center; 
    min-height: 100vh;
}
body:has(.report-container) {
    align-items: flex-start;
}

/* Estilos Comunes de Contenedores */
.container, .report-container {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15); 
    width: 90%;
    max-width: 1200px;
    padding: 0; 
    margin: 30px auto;
}

.container {
    max-width: 500px;
    padding-bottom: 30px;
}

.report-container {
    padding-bottom: 30px;
    overflow-x: hidden; 
}

/* Barra de colores en el top */
.top-color-bar {
    height: 6px;
    background: linear-gradient(to right, 
        var(--simit-blue) 0%, var(--simit-blue) 33%, 
        var(--simit-yellow) 33%, var(--simit-yellow) 66%, 
        var(--simit-red) 66%, var(--simit-red) 100%);
    border-radius: 8px 8px 0 0;
    width: 100%;
}

.header, .report-header {
    margin: 0 30px 30px;
    padding-top: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
    text-align: left;
}
.header {
    text-align: center; 
    width: auto;
}

/* ESTILOS DE TÍTULOS */
.simit-title {
    color: var(--text-dark); 
    font-size: 2.2em; 
    font-weight: 800; 
    margin: 0;
    display: block;
    text-align: center;
}
.simit-title-report {
    color: var(--text-dark); 
    font-size: 1.8em;
    font-weight: 800; 
    margin: 0;
}
/* FIN ESTILOS DE TÍTULOS */

/* Estilos de Formulario */
.login-box {
    margin: 0 30px;
    background-color: #fcfcfc;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 25px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
    text-align: left;
    box-sizing: border-box;
}

.login-box h2 {
    color: #555;
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 1.6em;
    text-align: center;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    color: #444;
    font-weight: bold;
    font-size: 0.9em;
}

.input-group input[type="text"],
.input-group input[type="password"],
.input-group select {
    width: 100%;
    padding: 12px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1.1em;
    appearance: none; 
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13.4-6.3h-258a17.6%2017.6%200%200%200-13.4%206.3%2017.6%2017.6%200%200%200%200%2025.2l128.8%20127.8c3.5%203.5%208.5%205.5%2013.8%205.5s10.3-2%2013.8-5.5L287%2094.6a17.6%2017.6%200%200%200%200-25.2z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 10px top 50%;
    background-size: 12px;
}

button[type="submit"] {
    background-color: var(--simit-blue);
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2em;
    font-weight: bold;
    transition: background-color 0.3s ease;
    width: 100%;
    margin-top: 15px;
}

button[type="submit"]:hover {
    background-color: #0056b3;
}

.datetime {
    margin-top: 25px;
    font-size: 0.9em;
    color: #888;
    text-align: center;
    display: block;
}

/* Estilos de Reporte */
.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center; 
    padding: 30px 30px 20px 30px;
    margin: 0; 
    border-bottom: none;
}

.user-info p {
    margin: 5px 0;
    font-size: 0.9em;
    color: #666;
}

.datetime-report {
    font-size: 0.9em;
    color: #777;
    text-align: right;
    align-self: flex-start; 
}

/* --- BLOQUE DE RESUMEN AZUL OSCURO --- */
.summary-block {
    background-color: var(--simit-blue);
    color: white;
    padding: 20px 30px;
    margin: 0 30px 30px 30px;
    border-radius: 5px;
    display: flex;
    justify-content: flex-start; 
    align-items: center;
    flex-wrap: wrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.summary-details {
    display: flex;
    align-items: center; 
    width: 100%; 
    gap: 20px;
}

.label-resumen {
    font-weight: bold;
    font-size: 1.3em !important;
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    padding-right: 20px;
    margin-right: 20px !important;
    white-space: nowrap; 
}

/* --- ESTILOS DEL BLOQUE DE TOTALES CLAROS --- */
.totals-claros-wrapper {
    background-color: var(--bg-light-gray); 
    border-radius: 4px;
    padding: 15px 20px; 
    color: var(--text-dark); 
    flex-grow: 1; 
    height: 100%;
    display: flex; 
    align-items: center;
}

.summary-items {
    display: flex;
    gap: 25px;
}

.summary-items p {
    color: var(--text-dark); 
    font-weight: normal; 
    font-size: 1em; 
}

.summary-items span {
    font-weight: bold; 
    color: var(--text-dark); 
    margin-left: 5px; 
}

.summary-items .total {
    font-weight: bold;
    font-size: 1.1em !important;
}
/* --- FIN AJUSTES DE TOTALES CLAROS --- */


.paz-salvo-message {
    color: #28a745; 
    font-weight: 600;
    padding: 20px 30px;
    text-align: center;
    font-size: 1.5em;
}

/* Contenedor de la tabla para control de desbordamiento */
.fines-table-wrapper {
    width: 95%;
    margin: 20px auto;
    overflow-x: auto;
}

.fines-table {
    width: 100%;
    min-width: 600px; 
    border-collapse: collapse;
}

.fines-table th, .fines-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}
.fines-table th {
    background-color: #f2f2f2;
    color: #333;
    font-weight: bold;
    font-size: 0.9em;
}
.fines-table .value, .fines-table .total-value {
    text-align: right;
    font-weight: bold;
}
.fines-table .total-row {
    background-color: #e0eaff;
    font-weight: bold;
}


/* --- INICIO ESTILOS DE BARRA DE CARGA --- */
.progress-section {
    margin: 40px 30px 0 30px;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fff;
    text-align: center; 
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
}
.progress-section p {
    color: #666;
    margin: 0;
}

.progress-indicator-group {
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 15px;
    margin-bottom: 5px; 
    margin-top: 15px;
}

#progress-percentage-left {
    font-size: 18px; 
    font-weight: bold; 
    color: var(--color-progress-text); 
    flex-shrink: 0;
}

.progress-bar-container {
    height: 20px; 
    max-width: 500px; 
    width: 100%; 
    background-color: var(--bg-light-gray); 
    border-radius: 10px; 
    overflow: hidden;
    position: relative;
    flex-grow: 1; 
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2); 
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(to bottom, var(--color-progress-fill-light), var(--color-progress-fill-dark)); 
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.6); 
}

#progress-percentage-display {
    display: block; 
    margin-top: 5px;
    font-weight: bold;
    font-size: 14px;
    color: var(--color-progress-text); 
}
/* --- FIN ESTILOS DE BARRA DE CARGA --- */


/* Responsive adjustments */
@media (max-width: 768px) {
    .container, .report-container {
        padding: 0;
        margin: 15px auto;
        width: 100%; 
    }
    .header, .report-header {
        margin: 0 15px 15px;
        padding-top: 15px;
        padding-bottom: 10px;
    }
    .login-box {
        margin: 0 15px;
        padding: 20px;
    }
    .simit-title {
        font-size: 1.8em;
    }
    .datetime {
        margin-top: 15px;
    }
    
    .report-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .simit-title-report {
        font-size: 1.5em;
        width: 100%;
        text-align: left;
    }
    .datetime-report {
        align-self: flex-end;
        width: 100%;
        text-align: right;
    }
    
    /* --- AJUSTE CLAVE 1: BLOQUE DE RESUMEN --- */
    .summary-block {
        flex-direction: column;
        align-items: flex-start;
        margin: 0 15px 20px 15px;
        padding: 15px;
        gap: 15px;
        width: calc(100% - 30px); 
        box-sizing: border-box;
    }
    .summary-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        width: 100%;
    }
    .totals-claros-wrapper {
        width: 100%; 
        /* CLAVE: Reducimos el padding horizontal del recuadro gris y lo ajustamos */
        padding: 10px 8px; 
        box-sizing: border-box;
    }
    .summary-items {
        font-size: 0.85em; /* Reducimos el texto un poco más */
        
        /* Reducimos el espaciado para que quepa en la pantalla */
        gap: 8px; 
        
        flex-wrap: wrap; 
        justify-content: space-between;
        width: 100%;
    }
    .summary-items p {
        /* Permite que los dos ítems principales (Comparendos y Multas) quepan */
        width: 48%; 
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }
    .summary-items .total {
        width: 100%; 
        text-align: left;
        margin-top: 5px;
    }
    .label-resumen {
        border-right: none;
        padding-right: 0;
        margin-right: 0 !important;
        padding-bottom: 5px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    }
    
    /* --- AJUSTE CLAVE 2: TABLA DE DETALLE --- */
    .fines-table-wrapper {
        width: calc(100% - 30px); 
        margin: 20px 15px;
        overflow-x: auto;
    }
    .fines-table {
        min-width: 600px; 
    }
    
    /* --- AJUSTE BARRA DE CARGA --- */
    .progress-section {
        margin: 20px 15px 0 15px;
        padding: 15px;
    }
    .progress-indicator-group {
        flex-direction: row;
        gap: 10px;
    }
    
    .fines-table th, .fines-table td {
        padding: 6px;
        font-size: 0.8em;
    }
}
