/* Web Fonts */
@font-face {
    font-family: 'Rugen-Expanded';
    src: url('/fonts/RugenExpanded.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: '華康儷粗黑';
    src: url('/fonts/LiCuHei.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Microsoft JhengHei Bold';
    src: url('/fonts/msjhbd.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

/* Label Preview Styles - 7.5cm x 5cm */
.label-preview {
    background: white;
    border: 1px solid #000;
    border-radius: 8px;
    width: 283px; /* 7.5cm at 96dpi */
    height: 189px; /* 5cm at 96dpi */
    min-height: 189px; /* Prevent shrinking */
    max-height: 189px; /* Prevent growing */
    font-family: 'Microsoft JhengHei', '微軟正黑體', sans-serif;
    padding: 6px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0; /* Never shrink */
}

/* Content Box (header + body) */
.label-content {
    border: 1px solid #000;
    border-radius: 5px 5px 0 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding: 2px 0 0 0;
}

/* Header */
.label-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding-top: 4px;
    padding-bottom: 4px;
    border-bottom: 1px solid #000;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.label-header .brand {
    font-family: 'Rugen-Expanded', 'Arial Black', sans-serif;
    font-size: 12px;
    font-weight: bold;
    color: #333;
    line-height: 1;
}

.label-header .product-name {
    font-family: '華康儷粗黑', sans-serif;
    font-size: 12px;
    font-weight: normal;
    color: #333;
    line-height: 1;
}

/* Body */
.label-body {
    display: flex;
    gap: 0;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Left Section */
.left-section {
    width: 80px;
    display: flex;
    flex-direction: column;
    gap: 0;
    flex-shrink: 0;
}

.gender-display {
    font-family: '華康儷粗黑', 'Microsoft JhengHei', sans-serif;
    font-size: 13px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 2px 4px;
    border-bottom: 1px dashed #000;
}

.color-display {
    font-family: 'Microsoft JhengHei Bold', sans-serif;
    font-size: 10px;
    font-weight: bold;
    text-align: center;
    padding: 2px 2px;
    line-height: 1.2;
    border-bottom: 1px dashed #000;
}

.color-display span {
    font-family: 'Microsoft JhengHei Bold', sans-serif;
    display: inline;
    font-size: 11px;
    font-weight: bold;
}

.color-display span.wrap {
    display: block;
}

.size-display {
    font-family: 'Microsoft JhengHei Bold', sans-serif;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    font-weight: bold;
    min-height: 35px;
}

/* Right Section */
.right-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-left: 1px dashed #000;
    padding: 1px 3px 0px 9px;
    min-width: 0;
    overflow: hidden;
}

.info-header {
    font-family: 'Rugen-Expanded', 'Arial Black', sans-serif;
    font-weight: bold;
    font-size: 11px;
    text-align: left;
    border-bottom: none;
    padding-bottom: 2px;
    margin-bottom: 2px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.info-header::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #000;
}

.info-content {
    display: flex;
    gap: 6px;
    flex: 1;
    min-height: 0;
}

.materials-list {
    font-family: 'Microsoft JhengHei', '微軟正黑體', sans-serif;
    font-size: 8px;
    font-weight: 400;
    line-height: 1.3;
    flex-shrink: 0;
}

.manufacturer-info {
    font-family: 'Microsoft JhengHei', '微軟正黑體', sans-serif;
    font-size: 7px;
    font-weight: 400;
    line-height: 1.2;
    color: #333;
    flex: 1;
}

/* Icons Row */
.label-icons-row {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 9px;
    padding-top: 0px;
    padding-bottom: 2px;
    margin-top: auto;
    flex-shrink: 0;
}

.label-icons-row .washing-icons {
    display: flex;
    gap: 2px;
    font-size: 10px;
    align-items: center;
}

.washing-icon-img {
    width: 12px;
    height: 12px;
    object-fit: contain;
}

.label-icons-row .made-in {
    font-family: 'Microsoft JhengHei', '微軟正黑體', sans-serif;
    font-weight: normal;
    background: white;
    color: #333;
    border: 1px solid #000;
    padding: 0px 2px;
    font-size: 7px;
    margin-left: auto;
    line-height: 1.2;
}

.label-icons-row .paper-logo {
    font-family: 'Rugen-Expanded', 'Arial Black', sans-serif;
    font-weight: bold;
    font-size: 11px;
    line-height: 1;
}

.label-icons-row .paper-logo sup {
    font-size: 3px;
    vertical-align: top;
}

/* Footer - Barcode Area */
.label-footer {
    margin-top: 2px;
    padding-top: 1px;
    flex-shrink: 0;
}

.barcode-container {
    width: 227px; /* 6cm at 96dpi */
    margin: 0 auto;
    border: none;
    padding: 2px;
    text-align: center;
}

.product-code {
    font-family: 'Microsoft JhengHei', '微軟正黑體', sans-serif;
    font-size: 10px;
    font-weight: 400;
    margin-bottom: 1px;
    letter-spacing: 0.5px;
    text-align: left;
}

.barcode-container svg {
    width: 100%;
    height: 25px;
    display: block;
}

/* Print Styles - 7.5cm x 5cm label */
@media print {
    @page {
        size: 7.5cm 5cm;
        margin: 0;
    }

    body {
        visibility: visible !important;
        background: white !important;
        margin: 0;
        padding: 0;
    }

    body * {
        visibility: hidden;
    }

    .preview-section,
    .preview-section * {
        visibility: visible !important;
    }

    .preview-section {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: white;
        padding: 0;
    }

    .preview-section h2,
    .print-actions {
        display: none !important;
    }

    #labelsContainer {
        display: block !important;
        max-height: none !important;
        overflow: visible !important;
        padding: 0 !important;
    }

    .label-preview {
        width: 7.5cm !important;
        height: 5cm !important;
        min-height: 5cm !important;
        max-height: 5cm !important;
        padding: 0.5cm !important;
        page-break-after: always;
        break-after: page;
        margin: 0;
        border-radius: 0;
        border: none;
        overflow: hidden !important;
    }

    .barcode-container {
        width: 6cm;
        border: none;
    }
}
