/* ===================================
   CSS Variables - ALK Brand Colors
   =================================== */
:root {
    --primary-color: #152466;
    --secondary-color: #FE8525;
    --accent-color: #219EBC;
    --bg-white: #FFFFFF;
    --bg-light: #F9F9F9;
    --text-dark: #2C3E50;
    --text-gray: #6C757D;
    --border-color: #E0E0E0;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s ease;
}

/* ===================================
   Reset & Base Styles
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    font-size: 16px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===================================
   Header
   =================================== */
.header {
    background-color: var(--bg-white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 20px 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    height: 50px;
    width: auto;
    transition: var(--transition);
}

.logo:hover {
    transform: scale(1.05);
}

.language-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-btn {
    background: none;
    border: none;
    color: var(--text-gray);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 4px;
    transition: var(--transition);
}

.lang-btn:hover {
    background-color: var(--bg-light);
    color: var(--primary-color);
}

.lang-btn.active {
    background-color: var(--primary-color);
    color: var(--bg-white);
}

.lang-separator {
    color: var(--border-color);
    font-weight: 300;
}

/* ===================================
   Main Content
   =================================== */
.main-content {
    padding: 60px 0;
    min-height: calc(100vh - 200px);
}

.page-header {
    text-align: center;
    margin-bottom: 50px;
}

.page-title {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    font-weight: 700;
}

.page-subtitle {
    font-size: 1.1rem;
    color: var(--text-gray);
    max-width: 600px;
    margin: 0 auto;
}

/* ===================================
   Form Styles
   =================================== */
.label-form {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Label Type Selector */
.label-type-selector {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.label-type-option {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    background-color: var(--bg-white);
}

.label-type-option:hover {
    border-color: var(--accent-color);
    background-color: var(--bg-light);
}

.label-type-option input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: 15px;
    cursor: pointer;
    accent-color: var(--secondary-color);
}

.label-type-option input[type="radio"]:checked ~ .label-type-content {
    color: var(--primary-color);
    font-weight: 600;
}

.label-type-option:has(input[type="radio"]:checked) {
    border-color: var(--secondary-color);
    background-color: rgba(254, 133, 37, 0.05);
}

.label-type-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.label-type-size {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
}

.label-type-inches {
    font-size: 0.9rem;
    color: var(--text-gray);
}

.form-card {
    background-color: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: var(--transition);
}

.form-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e3a8a 100%);
    padding: 20px 30px;
}

.card-title {
    color: var(--bg-white);
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0;
}

.card-body {
    padding: 30px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
    background-color: var(--bg-white);
    color: var(--text-dark);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(33, 158, 188, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #adb5bd;
}

.form-group textarea {
    resize: vertical;
    font-family: inherit;
}

/* ===================================
   Switch Toggle para Transbordo
   =================================== */
.switch-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

.switch-label {
    font-size: 0.95rem;
    color: var(--text-dark);
    font-weight: 500;
    min-width: 30px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 30px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--secondary-color);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--secondary-color);
}

input:checked + .slider:before {
    transform: translateX(30px);
}

.switch-label:first-child {
    opacity: 1;
}

.switch-label:last-child {
    opacity: 0.5;
}

input:checked ~ .switch-label:first-child {
    opacity: 0.5;
}

input:checked ~ .switch-label:last-child {
    opacity: 1;
    font-weight: 600;
    color: var(--secondary-color);
}

/* ===================================
   reCAPTCHA Container
   =================================== */
.recaptcha-container {
    display: flex;
    justify-content: center;
    padding: 20px;
    background-color: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

/* ===================================
   Buttons
   =================================== */
.form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--bg-white);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
    background-color: #0f1a4d;
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--text-gray);
    color: var(--bg-white);
}

.btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-2px);
}

.btn-accent {
    background-color: var(--secondary-color);
    color: var(--bg-white);
    box-shadow: var(--shadow-md);
}

.btn-accent:hover {
    background-color: #e67419;
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: var(--bg-white);
    transform: translateY(-2px);
}

/* ===================================
   Label Preview Section
   =================================== */
.label-preview-section {
    margin-top: 60px;
    animation: fadeInUp 0.5s ease;
}

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

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.preview-title {
    font-size: 2rem;
    color: var(--primary-color);
    font-weight: 700;
}

.preview-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.label-content {
    background-color: var(--bg-white);
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

/* ===================================
   Generated Label Styles - Compact Version
   =================================== */

/* Page break para impresión múltiple */
.page-break {
    page-break-after: always;
    break-after: page;
    height: 0;
    margin: 0;
    padding: 0;
}

/* Contenedor de etiqueta compacta */
.shipping-label-compact {
    border: 3px solid #000000;
    padding: 10px;
    background-color: #ffffff;
    margin: 0 auto 20px auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
    font-weight: bold; /* Todos los textos en negrita */
}

.shipping-label-compact * {
    font-weight: bold !important; /* Asegurar negrita en todos los elementos hijos */
}

/* Tamaños de etiqueta específicos */
.label-size-104x148 {
    width: 104mm;
    height: 148mm;
    max-width: 104mm;
}

.label-size-89x127 {
    width: 88.9mm;
    height: 127mm;
    max-width: 88.9mm;
}

.label-size-roll {
    width: 100mm;
    height: 140mm;
    max-width: 100mm;
}

/* Header: Nombre empresa + QR */
.header-compact {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 8px;
    border-bottom: 3px solid #000000;
}

.company-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.company-name {
    font-size: 1.3rem;
    font-weight: 900;
    color: #000000;
    letter-spacing: 0.5px;
}

/* Fecha de generación en header */
.generation-date {
    font-size: 0.75rem;
    color: #000000;
    margin-top: 2px;
    line-height: 1.2;
}

.qr-compact {
    width: 85px;
    height: 85px;
    flex-shrink: 0;
}

.qr-compact canvas {
    width: 100% !important;
    height: 100% !important;
}

/* AWB GRANDE */
.awb-section {
    text-align: center;
    border-bottom: 3px solid #000000;
    padding: 12px 0 10px 0;
}

.awb-large {
    font-family: 'Courier New', monospace;
    font-size: 1.5rem;
    font-weight: 900;
    color: #000000;
    letter-spacing: 2px;
    margin-bottom: 0;
}

/* Guía de consolidación (debajo del AWB en misma sección) */
.consolidation-guide {
    text-align: center;
    padding-top: 6px;
}

.consolidation-label {
    font-size: 0.75rem;
    color: #000000;
    text-transform: uppercase;
    margin-bottom: 2px;
    display: block;
    letter-spacing: 0.5px;
}

.consolidation-number {
    font-size: 1.05rem;
    font-weight: 700;
    color: #000000;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

/* Ruta: Origen → Destino */
.route-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 10px;
    border-bottom: 3px solid #000000;
    gap: 10px;
}

.route-item {
    flex: 1;
    text-align: center;
}

.route-label {
    font-size: 0.9rem;
    color: #000000;
    margin-bottom: 5px;
    text-transform: uppercase;
    font-weight: normal;
}

.route-code {
    font-size: 2.5rem;
    font-weight: 900;
    color: #000000;
    line-height: 1;
}

.route-arrow {
    font-size: 2rem;
    color: #000000;
    font-weight: bold;
    flex-shrink: 0;
}

/* Piezas GIGANTE */
.pieces-huge {
    text-align: center;
    padding: 20px 0;
    border-bottom: 3px solid #000000;
}

.pieces-label {
    font-size: 1rem;
    color: #000000;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.pieces-number {
    font-size: 4rem;
    font-weight: 900;
    color: #000000;
    line-height: 1;
}

/* Grid de info compacto */
.info-compact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.info-compact-cell {
    padding: 8px 6px;
    border-right: 3px solid #000000;
    text-align: center;
    overflow: hidden;
}

.info-compact-cell:last-child {
    border-right: none;
}

.info-compact-label {
    font-size: 0.75rem;
    color: #000000;
    margin-bottom: 3px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.info-compact-value {
    font-size: 1.35rem;
    font-weight: 900;
    color: #000000;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.1;
    max-width: 100%;
}

/* Ajustes para etiqueta pequeña (89x127) */
.label-size-89x127 .company-name {
    font-size: 1.15rem;
}

.label-size-89x127 .qr-compact {
    width: 75px;
    height: 75px;
}

.label-size-89x127 .awb-large {
    font-size: 1.3rem;
}

.label-size-89x127 .consolidation-number {
    font-size: 0.95rem;
}

.label-size-89x127 .consolidation-label {
    font-size: 0.7rem;
}

.label-size-89x127 .route-code {
    font-size: 2.2rem;
}

.label-size-89x127 .route-arrow {
    font-size: 1.8rem;
}

.label-size-89x127 .pieces-number {
    font-size: 3.5rem;
}

.label-size-89x127 .pieces-huge {
    padding: 15px 0;
}

.label-size-89x127 .info-compact-value {
    font-size: 1.25rem;
}

.label-size-89x127 .info-compact-label {
    font-size: 0.7rem;
}

.label-size-89x127 .info-compact-cell {
    padding: 6px 4px;
}

.label-size-89x127 .generation-date {
    font-size: 0.7rem;
}

/* Estilos antiguos - mantener solo para compatibilidad */

.label-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 12px;
    margin-bottom: 15px;
}

.label-logo {
    height: 35px;
    max-width: 150px;
    object-fit: contain;
}

.label-awb {
    text-align: right;
}

.label-awb-title {
    font-size: 0.75rem;
    color: var(--text-gray);
    margin-bottom: 3px;
}

.label-awb-number {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
}

.label-section {
    margin-bottom: 15px;
}

.label-section-title {
    background-color: var(--primary-color);
    color: var(--bg-white);
    padding: 6px 10px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 10px;
    border-radius: 3px;
}

.label-info {
    padding: 0 10px;
}

.label-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 10px;
    margin-bottom: 8px;
}

.label-field {
    display: flex;
    flex-direction: column;
}

.label-field-name {
    font-size: 0.7rem;
    color: var(--text-gray);
    margin-bottom: 2px;
    font-weight: 600;
    text-transform: uppercase;
}

.label-field-value {
    font-size: 0.8rem;
    color: var(--text-dark);
    font-weight: 500;
    word-wrap: break-word;
}

.label-route {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background-color: var(--bg-light);
    border-radius: 6px;
    margin: 15px 0;
}

.label-airport {
    text-align: center;
}

.label-airport-code {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
}

.label-airport-label {
    font-size: 0.7rem;
    color: var(--text-gray);
    margin-top: 3px;
}

.label-arrow {
    font-size: 1.5rem;
    color: var(--secondary-color);
}

.label-qr {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    background-color: var(--bg-light);
    border-radius: 6px;
    margin-top: 15px;
}

#qrcode {
    display: inline-block;
}

#qrcode canvas {
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    max-width: 100%;
    height: auto;
}

/* ===================================
   Footer
   =================================== */
.footer {
    background-color: var(--primary-color);
    color: var(--bg-white);
    text-align: center;
    padding: 30px 0;
    margin-top: 80px;
}

.footer p {
    margin: 0;
}

/* ===================================
   Responsive Design
   =================================== */

/* Tablets */
@media (max-width: 768px) {
    .page-title {
        font-size: 2rem;
    }
    
    .page-subtitle {
        font-size: 1rem;
    }
    
    .card-header {
        padding: 15px 20px;
    }
    
    .card-title {
        font-size: 1.2rem;
    }
    
    .card-body {
        padding: 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .preview-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .preview-title {
        font-size: 1.6rem;
    }
    
    .label-content {
        padding: 20px;
    }
    
    .shipping-label {
        padding: 20px;
    }
    
    .label-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .label-awb {
        text-align: center;
    }
    
    .label-route {
        flex-direction: column;
        gap: 10px;
    }
    
    .label-airport-code {
        font-size: 2rem;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .main-content {
        padding: 30px 0;
    }
    
    .page-header {
        margin-bottom: 30px;
    }
    
    .page-title {
        font-size: 1.6rem;
    }
    
    .logo {
        height: 40px;
    }
    
    .btn {
        padding: 12px 24px;
        font-size: 0.95rem;
        width: 100%;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .preview-actions {
        width: 100%;
    }
    
    .preview-actions .btn {
        flex: 1;
    }
    
    .label-awb-number {
        font-size: 1.4rem;
    }
    
    .label-logo {
        height: 45px;
    }
}

/* Print Styles */
@media print {
    body {
        margin: 0;
        padding: 0;
    }
    
    .header,
    .page-header,
    .footer,
    .form-section,
    .preview-header,
    .preview-actions {
        display: none !important;
    }
    
    .label-preview-section {
        margin: 0;
        padding: 0;
    }
    
    .label-content {
        box-shadow: none;
        padding: 0;
        margin: 0;
    }
    
    .shipping-label-compact {
        border: 2px solid #000;
        page-break-inside: avoid;
        margin: 0;
        padding: 8mm;
    }
    
    .page-break {
        page-break-after: always;
        break-after: page;
        height: 0;
        margin: 0;
    }
    
    /* Tamaño de página según tipo de etiqueta */
    @page {
        margin: 0;
    }
    
    /* Para etiquetas de 104x148mm */
    .label-size-104x148 {
        width: 104mm;
        height: 148mm;
    }
    
    /* Para etiquetas de 89x127mm */
    .label-size-89x127 {
        width: 88.9mm;
        height: 127mm;
    }
    
    /* Para etiquetas en rollo */
    .label-size-roll {
        width: 100mm;
        height: 140mm;
    }
}