﻿/* ==========================================================================
           1. VARIABLES DE DISEÑO (Colores basados en tu marca, tipografía y sombras)
           ========================================================================== */
:root {
    --color-primary-dark: #34495e; /* Azul pizarra de cabecera original */
    --color-primary-hover: #2c3e50; /* Variante hover del azul */
    --color-orange-accent: #ff6f3c; /* Naranja coral original */
    --color-red-alert: #e74c3c; /* Rojo para el botón y estados de falla */
    --color-red-hover: #c0392b;
    --color-green-success: #2ecc71; /* Verde para estados de aprobación */

    --bg-body: #f8fafc; /* Gris ultra claro moderno de fondo */
    --bg-card: #ffffff;
    --text-main: #2c3e50;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}


/* ==========================================================================
           3. BARRA DE NAVEGACIÓN Y ACCIONES SUPERIORES
           ========================================================================== */
.content-main-layout{
    height: calc( 100vh - 200px );
    padding: 10px 5px;
}

.content-navbar-options {
    display: flex;
    flex-direction: row;
    align-items: center;
    
}

.title-custon-navbar {
    font-size: 1.4rem;
    color: var(--text-muted);
}

.container-navbar {
    padding: 20px 30px 0px 30px;
}

.container-category{
    height: 10vh;
    box-sizing:border-box;
}


.container-action-header{
    display: flex;
    flex-direction: row;
    gap: 5px;
}

.top-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    background-color: transparent;
    border: 1px solid transparent;
    transition: var(--transition-smooth);
    cursor: pointer;
}

    .btn-back:hover {
        color: var(--text-main);
        background-color: #f1f5f9;
        border-color: var(--border-color);
    }

.btn-custom {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background-color: var(--color-red-alert);
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(231, 76, 60, 0.2);
    transition: var(--transition-smooth);
}

    .btn-custom:disabled {
        cursor: not-allowed;
        opacity: 0.6;
    }

    .btn-custom:hover {
        background-color: var(--color-red-hover);
        transform: translateY(-2px);
        box-shadow: 0 6px 14px rgba(231, 76, 60, 0.3);
    }

    .btn-custom svg {
        fill: currentColor;
        width: 18px;
        height: 18px;
    }

    .btn-custom.excel {
        background-color: #185C37;
    }

        .btn-custom.excel:hover {
            background-color: #207747;
            transform: translateY(-2px);
            box-shadow: 0 6px 14px #28a05e77;
        }

    .btn-custom.standar {
        background-color: #4F46E5;
    }

        .btn-custom.standar:hover {
            background-color: #524af7;
            transform: translateY(-2px);
            box-shadow: 0 6px 14px #534af760;
        }





/* ==========================================================================
           5. ACORDEONES DE CATEGORÍAS (Ej. Cocina, Baños)
           ========================================================================== */
.category-section {
    margin-bottom: 30px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background-color: var(--bg-card);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.category-header {
    background-color: var(--color-primary-dark);
    color: #ffffff;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: var(--transition-smooth);
}

    .category-header:hover {
        background-color: var(--color-primary-hover);
    }

.category-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.category-toggle-icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
    transition: transform 0.3s ease;
}

.category-section.collapsed .category-toggle-icon {
    transform: rotate(-90deg);
}

.category-content {
    padding: 24px;
    transition: max-height 0.3s ease-out;
    max-height: 5000px; /* Suficientemente alto para desplegar contenido */
    overflow: hidden;
}

.category-section.collapsed .category-content {
    max-height: 0;
    padding: 0;
}

/* ==========================================================================
           6. SUB-CABECERAS DE ÍTEMS DE CONTROL (Ej. Cerámica, Cubierta de Cocina)
           ========================================================================== */
.sub-category {
    margin-bottom: 24px;
}

    .sub-category:last-child {
        margin-bottom: 0;
    }

.sub-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f1f5f9;
}

.sub-icon {
    width: 24px;
    height: 24px;
    background-color: rgba(255, 111, 60, 0.1);
    color: var(--color-orange-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .sub-icon svg {
        width: 14px;
        height: 14px;
        fill: currentColor;
    }

.sub-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
}

.sub-date {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    background-color: #f1f5f9;
    padding: 4px 10px;
    border-radius: 30px;
    margin-left: 8px;
    font-weight: 500;
}

    .sub-date svg {
        width: 14px;
        height: 14px;
        fill: currentColor;
    }

/* ==========================================================================
           7. TABLA DE CONTROL DE CALIDAD DE ÚLTIMA GENERACIÓN
           ========================================================================== */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: #ffffff;
    margin-bottom: 16px;
}

.control-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.92rem;
    min-width: 900px;
}

    .control-table th {
        background-color: #f8fafc;
        color: var(--text-muted);
        font-weight: 600;
        text-transform: uppercase;
        font-size: 0.75rem;
        letter-spacing: 0.5px;
        padding: 14px 20px;
        border-bottom: 1px solid var(--border-color);
    }

    .control-table td {
        padding: 16px 20px;
        border-bottom: 1px solid #f1f5f9;
        vertical-align: middle;
        color: var(--text-main);
    }

    .control-table tr:last-child td {
        border-bottom: none;
    }

.col-id {
    width: 60px;
    font-weight: 600;
    color: var(--text-light);
}

.col-point {
    width: 25%;
    font-weight: 600;
}

.col-param {
    width: 25%;
    color: var(--text-muted);
}

.container-summary{
    height: 20vh;
}

/* Badges de cumplimiento mejorados */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

    .badge-status.fail {
        background-color: #fef2f2;
        color: var(--color-red-alert);
    }

        .badge-status.fail svg {
            width: 12px;
            height: 12px;
            fill: var(--color-red-alert);
        }

    .badge-status.pass {
        background-color: #f0fdf4;
        color: var(--color-green-success);
    }

        .badge-status.pass svg {
            width: 12px;
            height: 12px;
            fill: var(--color-green-success);
        }

.observation-text {
    font-style: italic;
    color: var(--text-muted);
    font-weight: 500;
}

/* ==========================================================================
           8. CONTENEDOR DE REGISTRO FOTOGRÁFICO
           ========================================================================== */
.photo-container {
    position: relative;
    width: 110px;
    height: 80px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
    background-color: #f1f5f9;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
}

    .photo-container:hover {
        transform: scale(1.05);
        box-shadow: var(--shadow-md);
        border-color: var(--color-orange-accent);
    }

.photo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(44, 62, 80, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition-smooth);
}

.photo-container:hover .photo-overlay {
    opacity: 1;
}

.photo-overlay svg {
    width: 20px;
    height: 20px;
    fill: #ffffff;
}

.photo-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 4px;
    max-width: 110px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Placeholder SVG si no hay foto real */
.photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    padding: 8px;
    text-align: center;
}

    .photo-placeholder svg {
        width: 24px;
        height: 24px;
        margin-bottom: 4px;
        fill: var(--text-light);
    }

    .photo-placeholder span {
        font-size: 0.65rem;
        font-weight: 500;
    }

.img-register{
    max-width: 150px
}
/* ==========================================================================
           9. MODAL INTERACTIVO PARA VER DETALLES DE FOTOS
           ========================================================================== */
.modal {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}

    .modal.open {
        display: flex;
        opacity: 1;
    }

.modal-content {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 650px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.open .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-main);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    transition: var(--transition-smooth);
}

    .modal-close:hover {
        color: var(--color-red-alert);
    }

.modal-body-fails {
    padding: 24px;
    text-align: center;
}

.modal-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius-md);
    object-fit: contain;
    box-shadow: var(--shadow-sm);
}

.modal-desc {
    margin-top: 16px;
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ==========================================================================
           10. MENSAJES DE RESPUESTA FLOTANTES (TOAST)
           ========================================================================== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background-color: var(--color-primary-dark);
    color: #ffffff;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 1100;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(100px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ==========================================================================
           11. DISEÑO RESPONSIVO (Adaptabilidad extrema para Tabletas y Celulares)
           ========================================================================== */
@media (max-width: 992px) {
    .filter-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: 100%;
    }

    .filter-buttons {
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    body {
        padding: 16px 8px;
    }

    .top-navbar {
        margin-bottom: 16px;
    }

    .category-content {
        padding: 16px 12px;
    }
    /* Transformación de tabla plana a tarjetas fluidas en móviles */
    .control-table, .control-table tbody, .control-table tr, .control-table td {
        display: block;
        width: 100%;
    }

        .control-table thead {
            display: none; /* Ocultar cabecera en móvil */
        }

        .control-table tr {
            background: #fdfdfd;
            border: 1px solid var(--border-color);
            border-radius: var(--radius-md);
            margin-bottom: 16px;
            padding: 14px;
            box-shadow: var(--shadow-sm);
        }

        .control-table td {
            border-bottom: 1px solid #f1f5f9;
            padding: 10px 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
            min-width: 0;
        }

            .control-table td:last-child {
                border-bottom: none;
            }
            /* Añadir etiquetas artificiales */
            .control-table td::before {
                content: attr(data-label);
                font-weight: 700;
                color: var(--text-muted);
                text-transform: uppercase;
                font-size: 0.72rem;
                margin-right: 16px;
            }

    .col-id, .col-point, .col-param {
        width: 100% !important;
        text-align: right;
    }

    .photo-label {
        margin-left: auto;
    }
}