/* ==========================================================================
   Calculator Modal Styles (Inspirado en el dashboard de la imagen)
   ========================================================================== */

.calc-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.calc-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.calc-modal-container {
    background: #f4f5f7; /* Fondo gris claro similar a la imagen */
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    font-family: 'Outfit', sans-serif;
}

.calc-modal-overlay.active .calc-modal-container {
    transform: translateY(0);
}

.calc-modal-header {
    background: white;
    padding: 1.2rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
}

.calc-modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.calc-btn-close {
    background: transparent;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #6b7280;
    transition: color 0.2s;
    line-height: 1;
}

.calc-btn-close:hover {
    color: #ef4444;
}

.calc-modal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative; /* Para el modal de leads e historial */
}

/* LEFT COLUMN - INPUTS */
.calc-left-col {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
}

.calc-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #4b5563;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.calc-form-group {
    margin-bottom: 1.5rem;
}

.calc-form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.calc-form-row .calc-form-group {
    flex: 1;
    margin-bottom: 0;
}

.calc-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.calc-input, .calc-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    color: #111827;
    background-color: #f9fafb;
    transition: all 0.2s;
    font-family: inherit;
    box-sizing: border-box;
}

.calc-input:focus, .calc-select:focus {
    outline: none;
    border-color: #f97316;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.calc-action-bar {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.btn-calc-primary {
    background: #f97316;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-calc-primary:hover {
    background: #ea580c;
}

.btn-calc-secondary {
    background: white;
    color: #4b5563;
    border: 1px solid #d1d5db;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-calc-secondary:hover {
    background: #f3f4f6;
    color: #111827;
}

/* RIGHT COLUMN - RESULTS */
.calc-right-col {
    flex: 1.2;
    padding: 2rem;
    overflow-y: auto;
    background: #f4f5f7;
    position: relative;
}

.results-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9ca3af;
    text-align: center;
}

.results-placeholder h3 {
    font-size: 1.2rem;
    margin-top: 1rem;
    color: #6b7280;
}

.results-content {
    display: none;
    animation: fadeIn 0.5s ease;
}

.results-content.active {
    display: block;
}

.results-header {
    margin-bottom: 2rem;
}

.results-header h3 {
    font-size: 1.8rem;
    font-weight: 800;
    color: #111827;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.result-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.result-card.highlight {
    border-left: 4px solid #f97316;
}

.result-card.highlight-blue {
    border-left: 4px solid #3b82f6;
}

.result-card h4 {
    font-size: 0.9rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.result-value {
    font-size: 2rem;
    font-weight: 800;
    color: #111827;
    margin-bottom: 0.25rem;
}

.result-desc {
    font-size: 0.9rem;
    color: #4b5563;
}

.result-data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.result-data-table th, .result-data-table td {
    padding: 1rem 0;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

.result-data-table th {
    font-weight: 600;
    color: #374151;
    font-size: 0.95rem;
}

.result-data-table td {
    color: #111827;
    font-weight: 700;
    text-align: right;
}

.result-data-table tr:last-child th,
.result-data-table tr:last-child td {
    border-bottom: none;
}

/* ==========================================================================
   Lead Capture Modal
   ========================================================================== */
.lead-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lead-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.lead-modal-box {
    background: white;
    width: 90%;
    max-width: 450px;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid #e5e7eb;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.lead-modal-overlay.active .lead-modal-box {
    transform: scale(1);
}

.lead-modal-box h3 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    text-align: center;
}

.lead-modal-box p {
    text-align: center;
    color: #6b7280;
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.btn-lead-submit {
    width: 100%;
    background: #3b82f6;
    color: white;
    border: none;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 1rem;
}

.btn-lead-submit:hover {
    background: #2563eb;
}

/* ==========================================================================
   History Modal
   ========================================================================== */
.history-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 20;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.history-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.history-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-history-back {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #4b5563;
    font-weight: bold;
}

.history-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th, .history-table td {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

.history-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
}

.history-empty {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .calc-modal-body {
        flex-direction: column;
        overflow-y: auto;
    }
    .calc-modal-container {
        height: 95vh;
    }
    .calc-left-col, .calc-right-col {
        flex: none;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        overflow-y: visible;
    }
}

/* ==========================================================================
   CALCULADORA ESCOLAR — Estilos específicos
   Paleta: verde educativo, azul cielo, naranja pedagógico
   ========================================================================== */

/* Override de color primario para la calculadora escolar */
#schoolCalcModal .calc-modal-header {
    background: linear-gradient(135deg, #0f4c75 0%, #1b7a4a 100%);
    border-bottom: none;
}

#schoolCalcModal .calc-modal-header h2 {
    color: #ffffff;
}

#schoolCalcModal .calc-btn-close {
    color: rgba(255,255,255,0.8);
}

#schoolCalcModal .calc-btn-close:hover {
    color: #ffffff;
}

#schoolCalcModal .btn-calc-primary {
    background: #1b7a4a;
}

#schoolCalcModal .btn-calc-primary:hover {
    background: #145e38;
}

#schoolCalcModal .calc-input:focus,
#schoolCalcModal .calc-select:focus {
    border-color: #1b7a4a;
    box-shadow: 0 0 0 3px rgba(27, 122, 74, 0.15);
}

/* Badge ubicación en resultados */
.sch-location-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    margin-bottom: 1.5rem;
}

/* Huerto checkbox toggle */
.sch-toggle-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    margin-bottom: 1.2rem;
    cursor: pointer;
}

.sch-toggle-row input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    accent-color: #16a34a;
    cursor: pointer;
}

.sch-toggle-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #15803d;
    cursor: pointer;
    user-select: none;
}

#schHuertoField {
    display: none;
    animation: fadeIn 0.3s ease;
}

/* Resultado: tarjeta de infraestructura (tanque) */
.sch-tank-card {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-left: 4px solid #3b82f6;
    border-radius: 12px;
    padding: 1.2rem 1.5rem;
    margin-top: 1rem;
}

.sch-tank-card h4 {
    color: #1d4ed8;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.sch-tank-card p {
    font-size: 0.95rem;
    color: #374151;
    line-height: 1.6;
}

.sch-tank-card strong {
    color: #1d4ed8;
}

/* Módulo Huerto Pedagógico */
.sch-huerto-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 1.5rem 0 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.sch-huerto-alert {
    border-radius: 14px;
    padding: 1.5rem 1.75rem;
    line-height: 1.7;
}

/* Sin huerto → naranja/rojo educativo */
.alert-sin-huerto {
    background: linear-gradient(135deg, #fff7ed 0%, #fef3c7 100%);
    border: 1px solid #fed7aa;
    border-left: 5px solid #f97316;
}

.alert-sin-huerto h3 {
    color: #c2410c;
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
}

.alert-sin-huerto p {
    color: #44403c;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.alert-sin-huerto strong {
    color: #c2410c;
}

/* Con huerto → verde ecológico */
.alert-con-huerto {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #86efac;
    border-left: 5px solid #16a34a;
}

.alert-con-huerto h3 {
    color: #15803d;
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
}

.alert-con-huerto p {
    color: #1c1917;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.alert-con-huerto strong {
    color: #15803d;
}

.sch-huerto-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.sch-call-action {
    font-weight: 700 !important;
    font-style: italic;
    margin-top: 0.5rem !important;
}

/* Botón abrir calculadora escolar */
.btn-calcula-school {
    cursor: pointer;
    background: linear-gradient(135deg, #0f4c75, #1b7a4a);
    color: white;
    border: none;
    padding: 0.85rem 1.75rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 1rem;
    margin-top: 1rem;
    width: 100%;
    transition: opacity 0.2s, transform 0.2s;
    font-family: 'Outfit', sans-serif;
}

.btn-calcula-school:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* ==========================================================================
   Botón de Imprimir Resultados (compartido por todas las calculadoras)
   ========================================================================== */

.btn-print-results {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.1rem;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: #0e7490;
    background: #ecfeff;
    border: 1.5px solid #a5f3fc;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s;
    white-space: nowrap;
}

.btn-print-results:hover {
    background: #cffafe;
    border-color: #0e7490;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 116, 144, 0.2);
}

.btn-print-results:active {
    transform: translateY(0);
    box-shadow: none;
}
