/* Scoped styling for E-commerce Shipping Label Generator */

.shipping-label-container {
    font-family: 'Outfit', sans-serif;
}

.upload-zone-logo {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    background-color: #f8fafc;
    transition: all 0.2s ease;
    position: relative;
}

.upload-zone-logo:hover, .upload-zone-logo.dragover {
    border-color: #4f46e5;
    background-color: #f1f5f9;
}

.logo-preview-thumb {
    max-height: 48px;
    max-width: 120px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
}

/* 4x6 Thermal Label Styling */
.label-outer-container {
    width: 100%;
    max-width: 384px;
    margin: 0 auto;
    overflow: visible;
}

.thermal-label-card {
    width: 384px;
    height: 576px;
    background-color: #ffffff;
    border: 4px solid #000000;
    color: #000000;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-sizing: border-box;
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

/* High contrast divider lines */
.label-divider-thick {
    border-top: 3px solid #000000;
    margin: 4px 0;
}

/* 1. TOP HEADER SECTION */
.label-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 2px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-grow: 1;
    overflow: hidden;
}

.label-logo-img {
    max-height: 38px;
    max-width: 100px;
    object-fit: contain;
}

.courier-title {
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1;
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    flex-shrink: 0;
    text-align: right;
}

.hub-code-container {
    display: inline-block;
}

.hub-code {
    font-size: 0.85rem;
    font-weight: 900;
    background: #000000;
    color: #ffffff;
    padding: 2px 6px;
    border-radius: 2px;
    line-height: 1.1;
    text-transform: uppercase;
    display: inline-block;
}

.badge-payment-mode {
    font-size: 0.82rem;
    font-weight: 900;
    text-transform: uppercase;
    border: 2px solid #000000;
    padding: 1px 5px;
    line-height: 1.1;
    display: inline-block;
}

.badge-payment-mode.cod-style {
    background-color: #000000;
    color: #ffffff;
}

.badge-payment-mode.prepaid-style {
    background-color: transparent;
    color: #000000;
}

.label-date {
    font-size: 0.65rem;
    font-weight: 800;
    opacity: 0.95;
    line-height: 1;
}

/* 2. MIDDLE ADDRESS SECTION */
.label-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.label-grid-cell {
    padding-right: 4px;
}

.label-grid-cell:last-child {
    padding-right: 0;
}

.customer-focus {
    background-color: #ffffff;
    border-left: 3px solid #000000 !important;
    padding-left: 8px !important;
    font-size: 0.82rem !important;
}

.customer-name-el {
    font-size: 0.95rem;
    display: inline-block;
    margin-bottom: 2px;
}

.label-address-box {
    font-size: 0.68rem;
    line-height: 1.3;
    word-break: break-word;
    overflow-wrap: anywhere;
    overflow: hidden;
}

.label-address-title {
    font-weight: 900;
    text-transform: uppercase;
    font-size: 0.7rem;
    margin-bottom: 2px;
    border-bottom: 1.5px solid #000000;
    padding-bottom: 1px;
}

#lblCustomerPincode, #lblSellerPincode {
    background-color: #000000;
    color: #ffffff;
    padding: 0px 4px;
    font-weight: 900;
    border-radius: 2px;
    display: inline-block;
    font-size: 0.72rem;
}

/* 3. DETAILS TABLE */
.label-details-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.68rem;
    margin: 3px 0;
}

.label-details-table td {
    border: 1.5px solid #000000;
    padding: 3px 4px;
    vertical-align: middle;
}

.lbl-label {
    background-color: #ffffff;
    font-weight: 800;
    text-transform: uppercase;
    width: 22%;
}

.lbl-val {
    font-weight: 600;
    width: 28%;
}

/* 4. BOTTOM ORDER ID SECTION */
.bottom-order-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
    margin: 2px 0;
    border: 2px solid #000000;
    background-color: #ffffff;
}

.bottom-order-id-label {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    opacity: 0.75;
    margin-bottom: 2px;
    line-height: 1;
}

.bottom-order-id-val {
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: 1.5px;
    font-family: 'Courier New', Courier, monospace;
    color: #000000;
    line-height: 1;
    text-align: center;
}

/* 5. HANDLING STRIP */
.handling-instructions-strip {
    text-align: center;
    font-weight: 900;
    font-size: 0.58rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 3px 0;
    background-color: #ffffff;
    border: 1.5px solid #000000;
}

/* 6. PAYMENT COLLECT BANNER */
.label-payment-banner {
    display: flex;
    border: 3px solid #000000;
    margin-top: 2px;
    overflow: hidden;
    height: 48px;
    background-color: #ffffff;
}

.label-payment-badge {
    width: 35%;
    background-color: #000000;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 900;
    text-transform: uppercase;
}

.label-payment-details {
    width: 65%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-left: 8px;
    font-weight: 700;
}

.collect-text {
    font-size: 0.55rem;
    font-weight: 800;
    text-transform: uppercase;
}

.label-payment-amount {
    font-size: 1.05rem;
    font-weight: 900;
}

/* Sticky preview panel */
.preview-sticky-box {
    position: sticky;
    top: 90px;
}

/* Validation items list */
.validation-list {
    max-height: 180px;
    overflow-y: auto;
    font-size: 0.8rem;
}

/* Screen Preview zoom scaling for mobile responsiveness */
@media (max-width: 440px) {
    .thermal-label-card {
        transform: scale(0.85);
        transform-origin: top center;
        margin-bottom: -50px !important; /* compensate for scale space */
    }
}
@media (max-width: 375px) {
    .thermal-label-card {
        transform: scale(0.72);
        transform-origin: top center;
        margin-bottom: -100px !important; /* compensate for scale space */
    }
}

/* Custom Size Layout Overrides for Preview Screen Display */

/* Size 4x6 (default layout style base) */
.thermal-label-card.size-4x6 {
    width: 384px;
    height: 576px;
}

/* Size 4x4 */
.thermal-label-card.size-4x4 {
    width: 384px;
    height: 384px;
    padding: 8px;
}
.size-4x4 {
    font-size: 0.64rem;
}
.size-4x4 .courier-title { font-size: 0.95rem; }
.size-4x4 .hub-code { font-size: 0.8rem; }
.size-4x4 .label-address-box { font-size: 0.62rem; line-height: 1.25; }
.size-4x4 .label-address-title { font-size: 0.65rem; }
.size-4x4 .label-details-table { font-size: 0.62rem; margin: 2px 0; }
.size-4x4 .label-details-table td { padding: 2px 3px; }
.size-4x4 .bottom-order-section { padding: 6px 0; }
.size-4x4 .bottom-order-id-val { font-size: 1.4rem; }
.size-4x4 .handling-instructions-strip { font-size: 0.54rem; padding: 1.5px 0; }
.size-4x4 .label-payment-banner { height: 40px; }
.size-4x4 .label-payment-badge { font-size: 1.1rem; }
.size-4x4 .label-payment-amount { font-size: 0.95rem; }

/* Size 4x3 */
.thermal-label-card.size-4x3 {
    width: 384px;
    height: 288px;
    padding: 6px;
    justify-content: space-between;
}
.size-4x3 {
    font-size: 0.58rem;
}
.size-4x3 .courier-title { font-size: 0.85rem; }
.size-4x3 .hub-code { font-size: 0.72rem; }
.size-4x3 .label-date { font-size: 0.6rem; }
.size-4x3 .badge-payment-mode { font-size: 0.72rem; }
.size-4x3 .label-divider-thick { border-top-width: 2px; margin: 3px 0; }
.size-4x3 .label-grid { grid-template-columns: 1fr !important; gap: 0; }
.size-4x3 .label-grid-cell.seller-details-box { display: none !important; } /* Hide FROM details */
.size-4x3 .label-grid-cell { border-left: none !important; padding-left: 0 !important; }
.size-4x3 .label-address-box { font-size: 0.55rem; line-height: 1.2; }
.size-4x3 .label-address-title { font-size: 0.58rem; }
.size-4x3 .label-details-table { font-size: 0.56rem; margin: 1px 0; }
.size-4x3 .label-details-table td { padding: 1.5px 2px; }
.size-4x3 .bottom-order-section { padding: 4px 0; border-width: 1.5px; }
.size-4x3 .bottom-order-id-val { font-size: 1.2rem; }
.size-4x3 .handling-instructions-strip { display: none !important; } /* Hide handling instructions strip */
.size-4x3 #bottomDividerThin, .size-4x3 #handlingPaymentDivider { display: none !important; }
.size-4x3 .label-payment-banner { height: 32px; border-width: 2px; }
.size-4x3 .label-payment-badge { font-size: 0.9rem; }
.size-4x3 .label-payment-amount { font-size: 0.8rem; }

/* Size 3x2 */
.thermal-label-card.size-3x2 {
    width: 288px;
    height: 192px;
    padding: 5px;
    justify-content: space-between;
}
.size-3x2 {
    font-size: 0.54rem;
}
.size-3x2 .courier-title { font-size: 0.8rem; }
.size-3x2 .hub-code { font-size: 0.65rem; }
.size-3x2 .label-date { display: none !important; }
.size-3x2 .badge-payment-mode { font-size: 0.65rem; border-width: 1.5px; }
.size-3x2 .label-grid { grid-template-columns: 1fr !important; gap: 0; }
.size-3x2 .label-grid-cell.seller-details-box { display: none !important; } /* Hide FROM details */
.size-3x2 .label-grid-cell { border-left: none !important; padding-left: 0 !important; }
.size-3x2 .label-address-box { font-size: 0.56rem; line-height: 1.2; }
.size-3x2 .label-address-title { font-size: 0.54rem; margin-bottom: 1px; }
.size-3x2 .label-details-table { display: none !important; } /* Hide details table in 3x2 */
.size-3x2 #midTableDivider, .size-3x2 #tableBottomDivider { display: none !important; }
.size-3x2 .bottom-order-section { padding: 4px 0; border-width: 1.5px; margin: 1px 0; }
.size-3x2 .bottom-order-id-val { font-size: 1.1rem; }
.size-3x2 .handling-instructions-strip { display: none !important; }
.size-3x2 #bottomDividerThin, .size-3x2 #handlingPaymentDivider { display: none !important; }
.size-3x2 .label-payment-banner { height: 26px; border-width: 1.5px; margin-top: 1px; }
.size-3x2 .label-payment-badge { font-size: 0.75rem; }
.size-3x2 .label-payment-amount { font-size: 0.75rem; }
.size-3x2 .collect-text { font-size: 0.45rem; }

/* Size 2x1 (Ultra-compact tag mode) */
.thermal-label-card.size-2x1 {
    width: 192px;
    height: 96px;
    padding: 4px;
    justify-content: center;
    align-items: center;
    border-width: 2.5px;
}
.size-2x1 {
    font-size: 0.45rem;
}
.size-2x1 .label-header { display: none !important; }
.size-2x1 .label-divider-thick { display: none !important; }
.size-2x1 .label-grid { display: none !important; }
.size-2x1 .label-details-table { display: none !important; }
.size-2x1 .bottom-order-section { display: none !important; }
.size-2x1 .handling-instructions-strip { display: none !important; }
.size-2x1 .label-payment-banner { display: none !important; }
.size-2x1 .label-mini-details {
    display: flex !important;
    width: 100%;
    height: 100%;
    flex-direction: column;
    justify-content: space-between;
    padding: 2px;
    box-sizing: border-box;
}
.size-2x1 .mini-row-order {
    font-size: 0.65rem;
    font-family: monospace;
    font-weight: 900;
    border-bottom: 1.5px solid #000000;
    padding-bottom: 1px;
    margin-bottom: 2px;
    line-height: 1.1;
}
.size-2x1 .mini-row-product {
    font-size: 0.52rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
    line-height: 1.1;
}
.size-2x1 .mini-row-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.5rem;
    line-height: 1.1;
}
.size-2x1 .mini-payment-badge {
    font-size: 0.48rem;
    font-weight: 900;
    border: 1px solid #000000;
    padding: 0 3px;
    border-radius: 1px;
}

/* Print Stylesheet Overrides */
@media print {
    body > :not(#printArea) {
        display: none !important;
    }
    
    html, body {
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        display: block !important;
        min-height: 0 !important;
        background: #ffffff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    #printArea {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        position: absolute;
        left: 0;
        top: 0;
    }

    .thermal-label-card {
        box-shadow: none !important;
        margin: 0 !important;
        page-break-after: always !important;
        page-break-inside: avoid !important;
        page-break-before: avoid !important;
        box-sizing: border-box !important;
        background-color: #ffffff !important;
    }
}
