:root {
    --color-salmon: #FF9A8B;
    --color-blanco: #FFFFFF;
    --color-negro: #333333;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--color-blanco);
    color: var(--color-negro);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: linear-gradient(135deg, var(--color-salmon) 0%, #ff7b6b 100%);
    color: var(--color-blanco);
    padding: 25px 0;
    text-align: center;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 6px 15px rgba(255, 154, 139, 0.3);
}

header h1 {
    font-size: 2.4rem;
    margin-bottom: 10px;
    font-weight: 700;
}

header p {
    font-size: 1.2rem;
    opacity: 0.95;
}

.mensaje-exito {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 5px solid #28a745;
    font-weight: 600;
}

.mensaje-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 5px solid #dc3545;
    font-weight: 600;
}

.main-content {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.form-section, .preview-section {
    flex: 1;
    min-width: 300px;
    background: var(--color-blanco);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 154, 139, 0.2);
}

.section-title {
    font-size: 1.5rem;
    color: var(--color-negro);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 3px solid var(--color-salmon);
    font-weight: 600;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--color-negro);
}

input, select, textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
    background-color: var(--color-blanco);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--color-salmon);
    box-shadow: 0 0 0 3px rgba(255, 154, 139, 0.2);
    outline: none;
}

.btn {
    display: inline-block;
    background: var(--color-salmon);
    color: var(--color-blanco);
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s;
    text-align: center;
    text-decoration: none;
}

.btn:hover {
    background: #ff7b6b;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(255, 154, 139, 0.3);
}

.btn-print {
    background: var(--color-negro);
    margin-top: 20px;
    width: 100%;
    padding: 16px;
}

.btn-print:hover {
    background: #555;
}

.label-preview {
    background: var(--color-blanco);
    border: 2px solid var(--color-salmon);
    border-radius: 12px;
    padding: 30px;
    min-height: 450px;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.label-header {
    text-align: center;
    margin-bottom: 35px;
    padding-bottom: 20px;
    border-bottom: 3px dashed var(--color-salmon);
}

.label-logo {
    height: 90px;
    background-color: var(--color-salmon); /* Solo de respaldo */
    margin-bottom: 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--color-blanco);
    /* Background image se aplicará desde el HTML */
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.address-section {
    display: flex;
    justify-content: space-between;
    margin-bottom: 35px;
    gap: 20px;
}

.sender, .recipient {
    flex: 1;
    padding: 20px;
    border-radius: 10px;
    background: rgba(255, 154, 139, 0.1);
}

.address-title {
    font-weight: bold;
    margin-bottom: 15px;
    color: var(--color-negro);
    font-size: 1.2rem;
    border-bottom: 2px solid var(--color-salmon);
    padding-bottom: 8px;
}

.address-content {
    line-height: 1.8;
    font-size: 1.05rem;
}

.barcode {
    text-align: center;
    margin-top: 35px;
    padding-top: 20px;
    border-top: 3px dashed var(--color-salmon);
}

.barcode-placeholder {
    height: 70px;
    background: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(255, 154, 139, 0.2) 5px, rgba(255, 154, 139, 0.2) 10px);
    margin-bottom: 15px;
    border-radius: 5px;
}

.destinatarios-list {
    max-height: 220px;
    overflow-y: auto;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 25px;
    background: var(--color-blanco);
}

.destinatario-item {
    padding: 12px;
    border-bottom: 2px solid rgba(255, 154, 139, 0.2);
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 6px;
    margin-bottom: 8px;
}

.destinatario-item:hover {
    background: rgba(255, 154, 139, 0.15);
    transform: translateX(5px);
}

.destinatario-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.destinatario-nombre {
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--color-negro);
}

.destinatario-direccion {
    font-size: 0.95rem;
    color: #666;
}

.sin-destinatarios {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

footer {
    text-align: center;
    margin-top: 40px;
    padding: 25px;
    color: var(--color-negro);
    font-size: 1rem;
    border-top: 2px solid var(--color-salmon);
}

/* ... (todo el CSS anterior se mantiene igual) ... */

/* Estilos para impresi車n - ACTUALIZADO */
@media print {
    body * {
        visibility: hidden;
        margin: 0;
        padding: 0;
    }
    
    .etiqueta-impresion, .etiqueta-impresion * {
        visibility: visible;
    }
    
    .etiqueta-impresion {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        max-width: 800px;
        box-shadow: none;
        border: 2px solid var(--color-salmon) !important;
        border-radius: 12px !important;
        margin: 0;
        padding: 30px;
        background: white;
    }
    
    .btn-print {
        display: none;
    }
    
    /* Asegurar que no haya m芍rgenes extra */
    @page {
        margin: 0.5cm;
        size: auto;
    }
    
    body {
        margin: 0;
        padding: 0;
        background: white;
    }
}
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    .address-section {
        flex-direction: column;
    }
    .sender, .recipient {
        width: 100%;
        margin-bottom: 20px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    header p {
        font-size: 1.1rem;
    }
}

/* ... (mantener todo el CSS anterior igual) ... */

/* Estilos para impresión - CORREGIDO */
@media print {
    body * {
        visibility: hidden;
        margin: 0;
        padding: 0;
    }
    
    .etiqueta-impresion, .etiqueta-impresion * {
        visibility: visible;
    }
    
    .etiqueta-impresion {
        position: absolute;
        left: 0.5cm;
        top: 0.5cm;
        width: calc(100% - 1cm);
        height: calc(100% - 1cm);
        box-shadow: none;
        border: 2px solid var(--color-salmon) !important;
        border-radius: 12px !important;
        margin: 0;
        padding: 20px;
        background: white;
        transform: none;
        page-break-after: avoid;
        page-break-inside: avoid;
    }
    
    .btn-print {
        display: none;
    }
    
    /* Configuración de página */
    @page {
        margin: 0.5cm;
        size: letter; /* o A4 */
    }
    
    body {
        margin: 0;
        padding: 0;
        background: white;
        width: 100%;
        height: 100%;
    }
    
    /* Ajustar elementos internos para que quepan */
    .label-header {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }
    
    .label-logo {
        height: 60px !important;
        margin-bottom: 10px;
    }
    
    .address-section {
        margin-bottom: 20px;
        gap: 15px;
    }
    
    .sender, .recipient {
        padding: 15px;
    }
    
    .address-content {
        font-size: 0.95rem;
        line-height: 1.6;
    }
}