/**
 * CSS para Configurador de Vidrios - MAIA
 */

/* ===== RESET Y LAYOUT BASE ===== */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 0;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.header h1 {
    margin: 0;
    font-size: 2.5em;
    font-weight: 300;
    text-align: center;
}

.header p {
    margin: 10px 0 0 0;
    text-align: center;
    opacity: 0.9;
    font-size: 1.1em;
}

/* ===== SISTEMA DE TABS ===== */
.tabs {
    display: flex;
    gap: 10px;
    background: white;
    padding: 15px;
    border-radius: 10px 10px 0 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 0;
    overflow-x: auto;
}

.tab-button {
    padding: 12px 24px;
    background: #f8f9fa;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
    color: #666;
}

.tab-button:hover {
    background: #e9ecef;
    color: #333;
}

.tab-button.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.tab-content {
    display: none;
    background: white;
    padding: 30px;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    min-height: 500px;
}

.tab-content.active {
    display: block;
}

/* ===== TOOLBAR ===== */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.toolbar h2 {
    margin: 0;
    font-size: 1.8em;
    font-weight: 400;
    color: #333;
}

.toolbar-actions {
    display: flex;
    gap: 10px;
}

/* ===== BOTONES ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-accion {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 5px 8px;
    transition: transform 0.2s ease;
}

.btn-accion:hover {
    transform: scale(1.2);
}

/* ===== TABLAS ===== */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

thead th {
    padding: 15px;
    text-align: left;
    font-weight: 500;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tbody tr {
    border-bottom: 1px solid #e9ecef;
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: #f8f9fa;
}

tbody td {
    padding: 15px;
    font-size: 14px;
}

td.acciones {
    text-align: right;
    white-space: nowrap;
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.badge.activo {
    background: #d4edda;
    color: #155724;
}

.badge.inactivo {
    background: #f8d7da;
    color: #721c24;
}

.badge.categoria-float,
.badge.categoria-parsol,
.badge.categoria-impreso,
.badge.categoria-mate,
.badge.categoria-laminar,
.badge.categoria-bajo_emisivo,
.badge.categoria-control_solar {
    background: #e7f3ff;
    color: #0066cc;
}

.badge.gas-aire {
    background: #cce5ff;
    color: #004085;
}

.badge.gas-argon {
    background: #d1ecf1;
    color: #0c5460;
}

/* ===== MODALES ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 25px;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
    font-weight: 400;
}

.close {
    font-size: 28px;
    font-weight: 300;
    color: #999;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 1;
    transition: color 0.2s ease;
}

.close:hover {
    color: #333;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ===== FORMULARIOS ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group.checkbox {
    display: flex;
    align-items: center;
}

.form-group.checkbox input {
    width: auto;
    margin-right: 10px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* ===== ALERTAS ===== */
.alert-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    max-width: 400px;
}

.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 14px;
    animation: slideInRight 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 1;
    transition: opacity 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

/* ===== FILTROS ===== */
.filtros {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.filtros label {
    display: inline-block;
    margin-right: 10px;
    font-weight: 500;
    color: #555;
}

.filtros select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

/* ===== TAB VARIANTES ===== */
.seleccion-familia {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.seleccion-familia h3 {
    margin: 0 0 15px 0;
    font-size: 1.3em;
    font-weight: 400;
}

/* ===== TAB RECARGOS ===== */
.recargos-section {
    margin-bottom: 40px;
}

.recargos-section h3 {
    font-size: 1.4em;
    font-weight: 400;
    margin: 0 0 20px 0;
    color: #667eea;
}

.input-editable {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 100%;
    transition: all 0.2s ease;
}

.input-editable:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

/* ===== TAB CALCULADORA ===== */
.calculadora-form {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.calculadora-form .form-row {
    margin-bottom: 15px;
}

.info-calculo {
    background: #e7f3ff;
    padding: 15px;
    border-radius: 6px;
    margin-top: 15px;
    font-size: 14px;
    color: #004085;
}

.info-calculo p {
    margin: 5px 0;
}

#resultadoCalculo {
    display: none;
    margin-top: 30px;
}

.resultado-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.resultado-header h3 {
    margin: 0;
    font-size: 1.5em;
    font-weight: 300;
}

.precio-total {
    font-size: 2.5em;
    font-weight: 600;
}

.desglose {
    background: white;
    border: 1px solid #e9ecef;
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 25px;
}

.desglose h4 {
    margin: 0 0 20px 0;
    font-size: 1.3em;
    font-weight: 400;
    color: #333;
}

.seccion-desglose {
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid #e9ecef;
}

.seccion-desglose:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.seccion-desglose h5 {
    margin: 0 0 15px 0;
    font-size: 1em;
    font-weight: 600;
    color: #667eea;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tabla-desglose {
    width: 100%;
    font-size: 14px;
}

.tabla-desglose tr {
    border-bottom: 1px solid #f8f9fa;
}

.tabla-desglose td {
    padding: 10px 5px;
}

.tabla-desglose td:first-child {
    color: #666;
}

.tabla-desglose td:last-child {
    text-align: right;
    font-weight: 500;
}

.tabla-desglose .total-row {
    background: #f8f9fa;
    font-weight: 600;
}

.tabla-desglose .total-row td {
    padding: 12px 5px;
    font-size: 15px;
}

.resultado-final {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #667eea;
}

.resultado-final h5 {
    color: #667eea;
    font-size: 1.1em;
}

.resultado-final .total-row.grande td {
    font-size: 18px;
    color: #667eea;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header h1 {
        font-size: 1.8em;
    }

    .tabs {
        flex-direction: column;
    }

    .tab-button {
        width: 100%;
        text-align: center;
    }

    .tab-content {
        padding: 15px;
    }

    .toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .toolbar-actions {
        flex-direction: column;
        width: 100%;
    }

    .toolbar-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-content {
        max-width: 100%;
        margin: 10px;
    }

    .resultado-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .precio-total {
        font-size: 2em;
    }

    table {
        font-size: 12px;
    }

    thead th,
    tbody td {
        padding: 10px 5px;
    }
}

/* ===== UTILIDADES ===== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }

.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.hidden {
    display: none;
}

/* ===== TAB CREAR VIDRIO ===== */
.creator-header {
    text-align: center;
    margin-bottom: 40px;
}

.creator-header h2 {
    font-size: 2em;
    font-weight: 400;
    margin: 0 0 10px 0;
    color: #667eea;
}

.creator-header p {
    color: #666;
    font-size: 1.1em;
}

.visual-creator {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 40px;
    margin-bottom: 40px;
}

.creator-inputs {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.input-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

.input-section h3 {
    margin: 0 0 20px 0;
    font-size: 1.2em;
    font-weight: 500;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-section h3 i {
    color: #667eea;
}

.checkbox-group {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #e9ecef;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 15px;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Vista Previa Visual */
.visual-preview {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.visual-preview h3 {
    margin: 0 0 25px 0;
    font-size: 1.3em;
    font-weight: 500;
    color: #333;
    text-align: center;
}

.glass-preview {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: stretch;
    gap: 5px;
    min-height: 300px;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 25px;
}

.glass-layer {
    flex: 1;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-radius: 8px;
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    border: 3px solid #2196f3;
    position: relative;
    transition: all 0.3s ease;
}

.glass-layer.exterior {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-color: #ff9800;
}

.glass-chamber {
    flex: 0.8;
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
    border-radius: 8px;
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    border: 3px dashed #9c27b0;
    position: relative;
    transition: all 0.3s ease;
}

.layer-label,
.chamber-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    margin-bottom: 10px;
}

.layer-name,
.chamber-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    word-break: break-word;
}

.layer-thickness,
.chamber-thickness {
    font-size: 20px;
    font-weight: 700;
    color: #667eea;
}

/* Especificaciones */
.glass-specs {
    background: white;
    padding: 20px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #667eea;
}

.spec-item strong {
    color: #555;
    font-size: 14px;
}

.spec-item span {
    color: #333;
    font-size: 14px;
    font-weight: 500;
}

.precio-highlight {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #28a745 !important;
}

.cantos-indicator {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid #28a745;
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.cantos-indicator i {
    font-size: 18px;
}

/* Acciones */
.creator-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 30px 0;
    border-top: 2px solid #e9ecef;
    border-bottom: 2px solid #e9ecef;
}

.creator-actions .btn-lg {
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 600;
}

/* Lista de Vidrios Creados */
.vidrios-creados h3 {
    font-size: 1.5em;
    font-weight: 400;
    margin-bottom: 20px;
    color: #333;
}

/* Responsive */
@media (max-width: 1024px) {
    .visual-creator {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .creator-actions {
        flex-direction: column;
    }

    .creator-actions .btn-lg {
        width: 100%;
    }

    .glass-preview {
        flex-direction: column;
        min-height: auto;
    }

    .glass-layer,
    .glass-chamber {
        min-height: 100px;
    }
}
