/*
 * Formulario Digital - Infraestructura Educativa Plan Maestro Cali
 * Copyright (c) 2025 Adolfo Salazar
 * Licensed under MIT License
 */

/* ================================================= */
/* == ESTILOS GENERALES Y VISTA HORIZONTAL        == */
/* ================================================= */

.table-container { 
    max-height: 80vh; 
    overflow: auto; 
    scroll-behavior: smooth; 
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 1;
}

.sticky-header th { 
    position: sticky; 
    top: 0; 
    z-index: 10; 
    background: #f3f4f6;
}

.input-field { min-width: 160px; width: 100%; box-sizing: border-box; position: static; padding: 18px; min-height: 60px; font-size: 16px; }
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); }
.modal-content { background-color: white; margin: 15% auto; padding: 20px; border-radius: 8px; width: 350px; text-align: center; position: relative; }
.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover,
.modal-close:focus {
    color: black;
    text-decoration: none;
}
.table-row { height: 110px; }
.table-cell { padding: 26px 18px; overflow: visible; position: relative; }
table { border-collapse: separate; border-spacing: 0; }
th, td { border: 2px solid #1e293b !important; }
th { background-color: #e2e8f0 !important; }
select, input { border: 1px solid #1e293b !important; background-color: white !important; position: relative; }
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 20px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 20px; border: none !important; }
.toggle-slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 2px; bottom: 2px; background-color: white; transition: .4s; border-radius: 50%; }
.toggle-switch input:checked + .toggle-slider { background-color: #10b981; }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }

.header-text {
    font-size: 10px;
    text-align: center;
    line-height: 1.2;
    font-weight: 600;
}

/* Media Queries para responsividad */
@media screen and (max-width: 768px) {
    .container { padding: 0.5rem; }
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    .input-field, select { min-height: 64px; padding: 20px 18px; font-size: 16px; min-width: 200px; }
    .table-row { height: 110px; }
    .table-cell { padding: 30px 20px; }
    .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { min-width: 100%; }
    .mobile-hide { display: none; }
    .buttons-container { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: space-between; }
    .btn-action { flex: 1 1 calc(50% - 0.25rem); padding: 10px 8px; font-size: 0.85rem; min-height: 48px; text-align: center; }
}

@media screen and (min-width: 769px) {
    .buttons-container { 
        display: flex; 
        flex-wrap: wrap; 
        gap: 0.4rem; 
        justify-content: flex-start; 
    }
    .btn-action { padding: 8px 12px; font-size: 0.85rem; min-height: 40px; white-space: nowrap; }
}

/* Utilidades y componentes específicos */
input[type="number"]::-webkit-outer-spin-button, 
input[type="number"]::-webkit-inner-spin-button { 
    -webkit-appearance: none; 
    margin: 0; 
}
input[type="number"] { -moz-appearance: textfield; }

.section-header { display: flex; flex-direction: column; margin-bottom: 1.5rem; padding: 0.5rem 0; border-bottom: 2px solid #d1d5db; }
.header-top { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-bottom: 0.5rem; }
.section-title { display: flex; align-items: center; gap: 0.5rem; font-weight: bold; font-size: 1.20rem; color: #1e293b; }
.row-info { font-size: 0.9rem; color: #4b5563; background-color: #f3f4f6; padding: 0.25rem 0.75rem; border-radius: 9999px; }
.btn-action { display: flex; align-items: center; justify-content: center; gap: 0.5rem; border-radius: 8px; font-weight: 600; transition: all 0.3s ease; text-align: center; white-space: nowrap; }
.btn-action:hover { transform: translateY(-2px); box-shadow: 0 4px 6px rgba(0,0,0,0.1); }

/* Componentes de fotos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 5px; margin-top: 10px; }
.photo-thumbnail { width: 60px; height: 60px; object-fit: cover; border-radius: 4px; border: 1px solid #ddd; }
.photo-modal { width: 400px; }
.camera-option { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px; border: 2px solid #e5e7eb; border-radius: 8px; cursor: pointer; transition: all 0.3s ease; }
.camera-option:hover { border-color: #3b82f6; background-color: #f8fafc; }

.export-modal { width: 300px; }
.developer-info { font-size: 1.1rem; font-weight: bold; }

/* ================================================= */
/* == PLANTILLA 1: VISTA DE TARJETAS VERTICALES   == */
/* ================================================= */

.vista-tarjeta table {
    display: block;
    width: -moz-max-content;
    width: max-content;
}

.vista-tarjeta .table-container {
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    flex-direction: row;
    padding-bottom: 20px;
    scrollbar-width: thin;
    scrollbar-color: #3b82f6 #e2e8f0;
}
.vista-tarjeta .table-container::-webkit-scrollbar { height: 8px; }
.vista-tarjeta .table-container::-webkit-scrollbar-track { background: #e2e8f0; border-radius: 4px; }
.vista-tarjeta .table-container::-webkit-scrollbar-thumb { background-color: #3b82f6; border-radius: 4px; }

.vista-tarjeta thead { display: none; }

.vista-tarjeta tbody {
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    transform: none !important;
}

.vista-tarjeta .table-row {
    display: flex;
    flex-direction: column;
    width: 320px;
    min-width: 320px;
    height: auto;
    max-height: 75vh; 
    overflow-y: auto;   
    border: 2px solid #1e293b;
    border-radius: 10px;
    background-color: #f8fafc;
    box-shadow: 0 4px 8px rgba(0,0,0,0.07);
    padding: 0 1.25rem 0.75rem 1.25rem;
    scrollbar-width: thin;
    scrollbar-color: #6b7280 #e5e7eb;
}

@media screen and (min-width: 1024px) {
    .vista-tarjeta .table-row {
        width: 480px;
        min-width: 480px;
    }
}

.vista-tarjeta .table-cell {
    display: flex;
    flex-direction: column;
    border: none !important;
    padding: 10px 0 !important;
    width: 100%;
}

/* ✅ INICIO DE LA MODIFICACIÓN */
.card-cell-label-text, .card-cell-header-with-toggle {
    display: none; /* Oculto por defecto en la vista horizontal */
}
.vista-tarjeta .card-cell-label-text {
    display: block; /* Visible en vista de tarjeta */
    font-size: 11px;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 6px;
    text-transform: uppercase;
}
.vista-tarjeta .card-cell-header-with-toggle {
    display: flex; /* Visible en vista de tarjeta */
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    position: relative;
    z-index: 2; /* Asegura que el interruptor esté por encima */
}
.vista-tarjeta .card-cell-header-with-toggle .card-cell-label-text {
    margin-bottom: 0;
}
/* ✅ FIN DE LA MODIFICACIÓN */


.vista-tarjeta .input-field {
    min-height: 50px;
    padding: 12px;
    font-size: 15px;
}

.vista-tarjeta .table-cell:last-child {
    order: -1;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0 12px 0 !important;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 8px;
    
    position: sticky;
    top: 0;
    background-color: #f8fafc;
    z-index: 1;
}

.vista-tarjeta .table-cell:last-child::before {
    display: none;
}

.card-header-info { display: none; }
.action-buttons-wrapper { text-align: center; } 

.vista-tarjeta .table-cell:last-child .card-header-info {
    display: block;
    color: #1e293b;
    font-size: 1.1rem;
}

.vista-tarjeta .table-cell:last-child .action-buttons-wrapper {
    display: flex;
    gap: 0.5rem;
}

.vista-tarjeta .virtual-spacer {
    display: none;
}
