/**
 * =============================================
 * SISTEMA DE PROFORMAS - ESTILOS PRINCIPALES
 * Versión: 1.0 - Estilo Azul Clásico
 * =============================================
 */

/* ===== RESET Y BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #667eea;
    --primary-dark: #5568d3;
    --secondary: #6c757d;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --light: #f8f9fa;
    --dark: #343a40;
    --white: #ffffff;
    --border: #dee2e6;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
    font-size: 14px;
}

/* ===== CONTENEDORES ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.container-fluid {
    width: 100%;
    padding: 0 20px;
}

/* ===== HEADER PRINCIPAL ===== */
.header-bar {
    background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
    color: white;
    padding: 15px 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-logo {
    height: 50px;
    border-radius: 8px;
    object-fit: contain;
}

.header-info h2 {
    font-size: 18px;
    margin: 0;
}

.header-info p {
    font-size: 12px;
    opacity: 0.9;
    margin: 0;
}

.header-center h1 {
    font-size: 22px;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-right: 15px;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
}

.user-role {
    font-size: 11px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

/* ===== ALERTAS ===== */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin: 20px auto;
    max-width: 1200px;
    position: relative;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-dismissible {
    padding-right: 45px;
}

.alert-close {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.alert-close:hover {
    opacity: 1;
}

/* ===== PANEL DE CONFIGURACIÓN ===== */
.config-panel {
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 25px;
    overflow: hidden;
}

.config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
}

.config-header h3 {
    margin: 0;
    font-size: 18px;
}

.config-body {
    padding: 25px;
    display: block;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.config-group h4 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 16px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    padding: 10px;
    cursor: pointer;
    transition: background 0.3s;
    border-radius: 6px;
}

.checkbox-label:hover {
    background: var(--light);
}

.checkbox-label input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ===== SECCIONES DE FORMULARIO ===== */
.form-section {
    background: white;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary);
}

.section-header h3 {
    color: var(--primary);
    font-size: 20px;
    margin: 0;
}

.section-actions {
    display: flex;
    gap: 10px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group-full {
    grid-column: 1 / -1;
}

.form-group label {
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.form-control,
.form-control-sm {
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s;
    width: 100%;
}

.form-control-sm {
    padding: 6px 10px;
    font-size: 13px;
}

.form-control:focus,
.form-control-sm:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control-readonly {
    background: #e9ecef;
    cursor: not-allowed;
}

.form-help {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* ===== TABLA DE PRODUCTOS ===== */
.table-responsive {
    overflow-x: auto;
}

.table-products {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.table-products thead {
    background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
    color: white;
}

.table-products th,
.table-products td {
    padding: 12px;
    text-align: left;
    border: 1px solid var(--border);
}

.table-products th {
    font-weight: 600;
    white-space: nowrap;
}

.table-products tbody tr {
    transition: background 0.2s;
}

.table-products tbody tr:hover {
    background: #f8f9fa;
}

.total-cell {
    font-weight: bold;
    color: var(--primary);
    text-align: right;
}

/* ===== GRUPOS ===== */
.grupos-container {
    margin: 25px 0;
}

.grupo-box {
    background: #e8f4f8;
    border: 2px solid var(--info);
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.grupo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--info);
}

.grupo-header h4 {
    color: var(--info);
    margin: 0;
    font-size: 18px;
}

.grupo-total {
    font-weight: bold;
    color: var(--info);
    font-size: 18px;
}

.grupo-descripcion {
    color: #666;
    font-size: 13px;
    margin: 10px 0;
}

.grupo-item-row {
    display: flex;
    justify-content: space-between;
    padding: 8px;
    background: white;
    margin: 5px 0;
    border-radius: 4px;
}

/* ===== TOTALES ===== */
.totales-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--primary);
}

.totales-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.total-item {
    background: var(--light);
    padding: 15px 20px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.total-item.total-general {
    background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
    color: white;
    grid-column: 1 / -1;
}

.total-label {
    font-weight: 600;
}

.total-value {
    font-size: 20px;
    font-weight: bold;
}

.payment-section {
    margin-top: 25px;
}

/* ===== UPLOAD DE IMÁGENES ===== */
.upload-area {
    border: 3px dashed var(--border);
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--light);
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.05);
}

.upload-icon {
    font-size: 60px;
    color: var(--primary);
    margin-bottom: 15px;
}

.upload-content h4 {
    color: var(--primary);
    margin-bottom: 10px;
}

.upload-content p {
    color: #666;
    font-size: 13px;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.preview-item {
    position: relative;
    border: 2px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.preview-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.preview-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.preview-remove:hover {
    transform: scale(1.1);
}

.preview-info {
    padding: 10px;
    background: var(--light);
    font-size: 12px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

/* ===== BOTONES ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-small {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-xs {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: #000;
}

.btn-info {
    background: var(--info);
    color: white;
}

.btn-link {
    background: transparent;
    color: var(--primary);
    text-decoration: underline;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-icon {
    padding: 8px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    transform: scale(1.1);
}

.action-buttons-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 2px solid var(--border);
    padding: 15px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 999;
}

.action-buttons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== BADGES ===== */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.badge-admin { background: #e74c3c; color: white; }
.badge-usuario { background: #3498db; color: white; }
.badge-visualizador { background: #95a5a6; color: white; }
.badge-borrador { background: #f39c12; color: #000; }
.badge-enviada { background: #3498db; color: white; }
.badge-aceptada { background: #27ae60; color: white; }
.badge-rechazada { background: #e74c3c; color: white; }
.badge-anulada { background: #95a5a6; color: white; }
.badge-secondary { background: #6c757d; color: white; }
.badge-info { background: #17a2b8; color: white; }

/* ===== ESTADÍSTICAS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--primary);
}

.stat-label {
    color: #666;
    font-size: 14px;
}

/* ===== FILTROS ===== */
.filters-section {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.filters-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

/* ===== TABLA DE DATOS ===== */
.table-container {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
    color: white;
}

.data-table th,
.data-table td {
    padding: 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr {
    transition: background 0.2s;
}

.data-table tbody tr:hover {
    background: var(--light);
}

.action-cell {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ===== ESTADO VACÍO ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-icon {
    font-size: 80px;
    color: #ddd;
    margin-bottom: 20px;
}

.empty-state h3 {
    color: #666;
    margin-bottom: 10px;
}

/* ===== NOTIFICACIONES TOAST ===== */
.notification-toast {
    position: fixed;
    top: 80px;
    right: -350px;
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 9999;
    min-width: 300px;
    transition: right 0.3s;
}

.notification-toast.show {
    right: 20px;
}

.notification-success { border-left: 4px solid var(--success); }
.notification-error { border-left: 4px solid var(--danger); }
.notification-warning { border-left: 4px solid var(--warning); }
.notification-info { border-left: 4px solid var(--info); }

/* ===== ANIMACIONES ===== */
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

.fade-in {
    animation: fade-in 0.3s ease;
}

.fade-out {
    animation: fade-out 0.3s ease forwards;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .header-right {
        flex-direction: column;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .config-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons-grid {
        grid-template-columns: 1fr;
    }
    
    .table-responsive {
        overflow-x: scroll;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== PRINT ===== */
@media print {
    .no-print,
    .header-bar,
    .btn,
    .action-buttons-fixed {
        display: none !important;
    }
    
    body {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}

/* Notificaciones */
.notification-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    color: white;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateX(200%);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.notification-toast.show {
    transform: translateX(0);
}

.notification-success {
    background-color: #28a745;
}

.notification-error {
    background-color: #dc3545;
}

.notification-info {
    background-color: #17a2b8;
}

.notification-warning {
    background-color: #ffc107;
    color: #212529;
}

/* Efectos de transición */
.fade-in {
    animation: fadeIn 0.3s ease;
}

.fade-out {
    animation: fadeOut 0.3s ease;
    opacity: 0;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Drag & Drop */
.drag-over {
    border: 2px dashed #17a2b8;
    background-color: rgba(23, 162, 184, 0.1);
}

/* Estilos específicos para la vista de proforma */
        
        .container-vista {
            max-width: 1000px;
            margin: 0 auto;
            padding: 20px;
        }
        
        .toolbar {
            background: white;
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 20px;
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }
        
        .btn {
            padding: 10px 20px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 14px;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: all 0.3s;
        }
        
        .btn-descargar-pdf {
            background: #dc3545;
            color: white;
        }
        
        .btn-descargar-pdf:hover {
            background: #c82333;
        }
        
        .btn-descargar-img {
            background: #28a745;
            color: white;
        }
        
        .btn-descargar-img:hover {
            background: #218838;
        }
        
        .btn-volver {
            background: #6c757d;
            color: white;
        }
        
        .btn-volver:hover {
            background: #5a6268;
        }
        
        .proforma {
            background: white;
            padding: 40px;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        
        .proforma-header {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr;
            gap: 20px;
            margin-bottom: 30px;
            border-bottom: 3px solid #17a2b8;
            padding-bottom: 20px;
        }
        
        .empresa-logo {
            text-align: center;
        }
        
        .empresa-logo img {
            max-width: 120px;
            height: auto;
        }
        
        .empresa-info {
            text-align: center;
        }
        
        .empresa-info h2 {
            color: #17a2b8;
            font-size: 20px;
            margin-bottom: 5px;
        }
        
        .empresa-info p {
            font-size: 12px;
            color: #666;
            margin: 2px 0;
        }
        
        .titulo-proforma {
            text-align: center;
            align-self: center;
        }
        
        .titulo-proforma h1 {
            font-size: 32px;
            color: #17a2b8;
            margin-bottom: 10px;
        }
        
        .fechas {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
            margin-bottom: 20px;
            padding: 15px;
            background: #f8f9fa;
            border-radius: 5px;
        }
        
        .fecha-item label {
            font-weight: bold;
            display: block;
            margin-bottom: 5px;
            color: #17a2b8;
        }
        
        .cliente-info {
            background: #f8f9fa;
            padding: 15px;
            border-radius: 5px;
            margin-bottom: 20px;
        }
        
        .cliente-info h3 {
            color: #17a2b8;
            font-size: 16px;
            margin-bottom: 10px;
            border-bottom: 2px solid #17a2b8;
            padding-bottom: 5px;
        }
        
        .cliente-field {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
            margin-bottom: 10px;
        }
        
        .cliente-field label {
            font-weight: bold;
            color: #333;
            font-size: 12px;
        }
        
        .tabla-productos {
            width: 100%;
            border-collapse: collapse;
            margin: 20px 0;
        }
        
        .tabla-productos thead {
            background: #17a2b8;
            color: white;
        }
        
        .tabla-productos th {
            padding: 12px;
            text-align: left;
            font-weight: bold;
            font-size: 13px;
            border: 1px solid #17a2b8;
        }
        
        .tabla-productos td {
            padding: 12px;
            border: 1px solid #ddd;
            font-size: 12px;
        }
        
        .tabla-productos tbody tr:nth-child(even):not(.grupo-total-row) {
            background: #f8f9fa;
        }
        
        .item-en-grupo {
            background: #e8f4f8 !important;
            border-left: 4px solid #b8b8b8 !important;
        }
        
        .grupo-total-row {
            background: linear-gradient(135deg, #bcbcbc 0%, #cfcfcf 100%) !important;
            color: white;
            font-weight: bold;
        }
        
        .grupo-total-row td {
            border: 2px solid #c1c1c1 !important;
           
        }
        
        .grupo-nombre {
            font-size: 15px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .grupo-descripcion {
            font-size: 10px;
            font-style: italic;
            opacity: 0.9;
            margin-top: 3px;
        }
        
        .numero {
            text-align: right;
        }
        
        .imagenes-section {
            margin: 30px 0;
            page-break-inside: avoid;
        }
        
        .imagenes-section h3 {
            color: #17a2b8;
            font-size: 18px;
            margin-bottom: 15px;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .imagenes-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
            gap: 15px;
            margin-top: 15px;
        }
        
        .imagen-item {
            border: 2px solid #ddd;
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
            background: white;
        }
        
        .imagen-item img {
            width: 100%;
            height: 200px;
            object-fit: cover;
            display: block;
        }
        
        .imagen-info {
            padding: 10px;
            background: #f8f9fa;
            font-size: 11px;
            color: #666;
            text-align: center;
        }
        
        .resumen-totales {
            margin: 20px 0;
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 15px;
        }
        
        .total-item {
            background: #f8f9fa;
            padding: 15px;
            border-radius: 5px;
            border-left: 4px solid #17a2b8;
        }
        
        .total-item label {
            display: block;
            font-weight: bold;
            color: #17a2b8;
            font-size: 12px;
            margin-bottom: 5px;
        }
        
        .total-item .valor {
            font-size: 18px;
            font-weight: bold;
            color: #333;
        }
        
        .total-item.principal {
            background: #17a2b8;
            color: white;
            border-color: #117a8b;
        }
        
        .total-item.principal label,
        .total-item.principal .valor {
            color: white;
        }
        
        .observaciones, .terminos {
            background: #f8f9fa;
            padding: 15px;
            border-radius: 5px;
            margin: 20px 0;
            border-left: 4px solid #ffc107;
        }
        
        .observaciones h4, .terminos h4 {
            color: #ffc107;
            margin-bottom: 10px;
        }
        
        .terminos {
            border-left-color: #6c757d;
        }
        
        .terminos h4 {
            color: #6c757d;
        }
        
        .saldo-pendiente {
            background: #fff3cd;
            padding: 15px;
            border-radius: 5px;
            margin: 20px 0;
            border-left: 4px solid #ffc107;
        }
        
        .saldo-pendiente label {
            font-weight: bold;
            color: #856404;
            display: block;
            margin-bottom: 8px;
        }
        
        .saldo-pendiente-valor {
            font-size: 18px;
            font-weight: bold;
            color: #856404;
        }
        
        .firma-area {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr;
            gap: 20px;
            margin-top: 30px;
        }
        
        .firma-box {
            text-align: center;
            padding-top: 40px;
            border-top: 1px solid #333;
        }
        
        .pie-proforma {
            margin-top: 30px;
            padding-top: 20px;
            border-top: 2px solid #ddd;
            text-align: center;
            font-size: 11px;
            color: #666;
        }
        
        @media print {
            .toolbar {
                display: none !important;
            }
            body {
                background: white;
            }
        }
        
        @media (max-width: 768px) {
            .proforma {
                padding: 20px;
            }
            .proforma-header {
                grid-template-columns: 1fr;
            }
            .imagenes-grid {
                grid-template-columns: 1fr;
            }
            .firma-area {
                grid-template-columns: 1fr;
            }
        }



        
/* ===== RESPONSIVE MOBILE ===== */
/* Tablets y dispositivos medianos */
@media (max-width: 992px) {
    .header-content {
        gap: 10px;
    }
    
    .header-center h1 {
        font-size: 18px;
    }
    
    .config-grid {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .totales-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .action-buttons-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Móviles y dispositivos pequeños */
@media (max-width: 768px) {
    /* Header adaptado */
    .header-bar {
        padding: 10px 0;
    }
    
    .header-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .header-left {
        flex-direction: column;
        text-align: center;
    }
    
    .header-logo {
        height: 40px;
    }
    
    .header-info h2 {
        font-size: 16px;
    }
    
    .header-center h1 {
        font-size: 16px;
        text-align: center;
    }
    
    .header-right {
        flex-direction: column;
        width: 100%;
    }
    
    .user-info {
        align-items: center;
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .header-actions {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }
    
    /* Contenedores */
    .container,
    .container-fluid {
        padding: 10px;
    }
    
    /* Formularios */
    .form-section {
        padding: 15px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .section-header h3 {
        font-size: 16px;
    }
    
    .section-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .section-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Config panel */
    .config-body {
        padding: 15px;
    }
    
    .config-header h3 {
        font-size: 16px;
    }
    
    /* Tabla de productos - Scroll horizontal */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-products {
        min-width: 700px;
    }
    
    .table-products th,
    .table-products td {
        padding: 8px;
        font-size: 12px;
    }
    
    /* Grupos */
    .grupo-box {
        padding: 15px;
    }
    
    .grupo-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .grupo-header h4 {
        font-size: 16px;
    }
    
    /* Upload de imágenes */
    .upload-area {
        padding: 20px;
    }
    
    .upload-icon {
        font-size: 40px;
    }
    
    .preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Botones */
    .action-buttons-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Estadísticas */
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    /* Filtros */
    .filters-form {
        flex-direction: column;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    /* Tabla de datos - Scroll horizontal */
    .data-table {
        min-width: 700px;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px;
        font-size: 12px;
    }
    
    .action-cell {
        flex-direction: column;
        gap: 4px;
    }
    
    /* Alertas */
    .alert {
        padding: 12px 15px;
        margin: 10px;
    }
    
    /* Notificaciones */
    .notification-toast {
        min-width: 250px;
        top: 10px;
        right: 10px;
    }
}

/* Móviles muy pequeños */
@media (max-width: 480px) {
    .header-logo {
        height: 35px;
    }
    
    .header-info h2 {
        font-size: 14px;
    }
    
    .header-center h1 {
        font-size: 14px;
    }
    
    .btn-small {
        padding: 5px 10px;
        font-size: 11px;
    }
    
    .preview-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-value {
        font-size: 20px;
    }
}


/* ===== RESPONSIVE PARA MOBILES LLML
===== */


/* ===== RESPONSIVE MOBILE ===== */
/* Tablets y dispositivos medianos */
@media (max-width: 992px) {
    .header-content {
        gap: 10px;
    }
    
    .header-center h1 {
        font-size: 18px;
    }
    
    .config-grid {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .totales-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .action-buttons-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Móviles y dispositivos pequeños */
@media (max-width: 768px) {
    /* Header adaptado */
    .header-bar {
        padding: 10px 0;
    }
    
    .header-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .header-left {
        flex-direction: column;
        text-align: center;
    }
    
    .header-logo {
        height: 40px;
    }
    
    .header-info h2 {
        font-size: 16px;
    }
    
    .header-center h1 {
        font-size: 16px;
        text-align: center;
    }
    
    .header-right {
        flex-direction: column;
        width: 100%;
    }
    
    .user-info {
        align-items: center;
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .header-actions {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }
    
    /* Contenedores */
    .container,
    .container-fluid {
        padding: 10px;
    }
    
    /* Formularios */
    .form-section {
        padding: 15px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .section-header h3 {
        font-size: 16px;
    }
    
    .section-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .section-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Config panel */
    .config-body {
        padding: 15px;
    }
    
    .config-header h3 {
        font-size: 16px;
    }
    
    /* Tabla de productos - Scroll horizontal */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-products {
        min-width: 700px;
    }
    
    .table-products th,
    .table-products td {
        padding: 8px;
        font-size: 12px;
    }
    
    /* Grupos */
    .grupo-box {
        padding: 15px;
    }
    
    .grupo-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .grupo-header h4 {
        font-size: 16px;
    }
    
    /* Upload de imágenes */
    .upload-area {
        padding: 20px;
    }
    
    .upload-icon {
        font-size: 40px;
    }
    
    .preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Botones */
    .action-buttons-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Estadísticas */
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    /* Filtros */
    .filters-form {
        flex-direction: column;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    /* Tabla de datos - Scroll horizontal */
    .data-table {
        min-width: 700px;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px;
        font-size: 12px;
    }
    
    .action-cell {
        flex-direction: column;
        gap: 4px;
    }
    
    /* Alertas */
    .alert {
        padding: 12px 15px;
        margin: 10px;
    }
    
    /* Notificaciones */
    .notification-toast {
        min-width: 250px;
        top: 10px;
        right: 10px;
    }
}

/* Móviles muy pequeños */
@media (max-width: 480px) {
    .header-logo {
        height: 35px;
    }
    
    .header-info h2 {
        font-size: 14px;
    }
    
    .header-center h1 {
        font-size: 14px;
    }
    
    .btn-small {
        padding: 5px 10px;
        font-size: 11px;
    }
    
    .preview-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-value {
        font-size: 20px;
    }
}

/* ===== RESPONSIVE PARA VISTA PREVIA (NO AFECTA EL DOCUMENTO) ===== */
@media (max-width: 768px) {
    /* Solo ajustamos los controles, NO el documento */
    .container-vista {
        padding: 10px;
    }
    
    .toolbar {
        flex-direction: column;
        padding: 10px;
    }
    
    .toolbar .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* El documento .proforma mantiene su estructura EXACTA */
    .proforma {
        /* Hacemos que se pueda hacer scroll horizontal si es necesario */
        min-width: 800px;
        overflow-x: auto;
    }
    
    /* Alternativa: Escalar el documento proporcionalmente */
    .proforma-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ===== ESTILOS ESPECÍFICOS PARA IMPRESIÓN ===== */
@media print {
    /* Ocultar elementos de UI */
    .no-print,
    .header-bar,
    .toolbar,
    .btn,
    .action-buttons-fixed,
    .config-panel,
    .filters-section,
    .preview-remove,
    .alert {
        display: none !important;
    }
    
    /* Asegurar colores en impresión */
    body {
        background: white;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
    
    /* Documento a tamaño completo */
    .proforma {
        padding: 20px;
        box-shadow: none;
        page-break-inside: avoid;
    }
    
    /* Evitar saltos de página en elementos importantes */
    .proforma-header,
    .cliente-info,
    .grupo-box,
    .resumen-totales,
    .tabla-productos thead {
        page-break-inside: avoid;
        page-break-after: avoid;
    }
    
    /* Asegurar que las imágenes se impriman */
    .imagen-item img {
        max-height: 150px;
        page-break-inside: avoid;
    }
    
    /* Optimizar tabla para impresión */
    .tabla-productos {
        width: 100%;
        font-size: 11px;
    }
    
    .tabla-productos th,
    .tabla-productos td {
        padding: 8px 6px;
    }
    
    /* Evitar que los totales se dividan */
    .resumen-totales,
    .saldo-pendiente {
        page-break-inside: avoid;
    }
}

/* ===== MODO LANDSCAPE PARA TABLETS ===== */
@media (max-width: 1024px) and (orientation: landscape) {
    .header-content {
        flex-direction: row;
    }
    
    .header-center h1 {
        font-size: 18px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .action-buttons-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== ACCESIBILIDAD ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Alto contraste */
@media (prefers-contrast: high) {
    :root {
        --border: #000;
        --shadow: 0 2px 10px rgba(0,0,0,0.3);
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* ===== FIX PARA iOS SAFARI ===== */
@supports (-webkit-touch-callout: none) {
    .form-control,
    .form-control-sm,
    input,
    textarea,
    select {
        font-size: 16px; /* Previene zoom automático en iOS */
    }
}