:root {
    --brand-orange: #E8601C;
    --brand-orange-dark: #C44E10;
    --brand-orange-light: #F5884A;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
    background-color: #f5f5f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Site Header ── */
.site-header {
    background: #ffffff;
    border-bottom: 3px solid var(--brand-orange);
    padding: 12px 0;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: center;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo {
    height: 52px;
    width: auto;
    object-fit: contain;
}

.header-title {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.header-title-main {
    font-size: 22px;
    font-weight: bold;
    color: #1a1a1a;
    letter-spacing: 1px;
}

.header-title-sub {
    font-size: 11px;
    color: var(--brand-orange);
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* ── Site Footer ── */
.site-footer {
    background: #ffffff;
    border-top: 3px solid var(--brand-orange);
    padding: 14px 0;
    margin-top: auto;
}

.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    text-align: center;
    font-size: 12px;
    color: #888;
    letter-spacing: 1px;
}

.footer-inner span {
    color: #555;
    font-weight: 700;
}

.footer-inner span b {
    color: var(--brand-orange);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.main-content {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

/* Preview Section */
.preview-section {
    flex: 1.2;
    min-width: 620px;
    background: #e0e0e0;
    border-radius: 10px;
    padding: 20px;
}

.preview-section h2 {
    margin-bottom: 20px;
    color: #333;
}

.label-count {
    font-size: 14px;
    font-weight: normal;
    color: var(--brand-orange);
    margin-left: 10px;
}

#labelsContainer {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 10px;
    justify-items: center;
}

.print-actions {
    margin-top: 20px;
    text-align: center;
}

/* Form Section */
.form-section {
    flex: 1;
    min-width: 400px;
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-height: 90vh;
    overflow-y: auto;
}

.form-section h2 {
    margin-bottom: 20px;
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-weight: bold;
    color: #333;
}

.label-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--brand-orange);
    color: white;
    border-radius: 50%;
    font-size: 12px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--brand-orange);
}

.input-row {
    display: flex;
    gap: 10px;
}

.input-row .form-control {
    flex: 1;
}

/* Radio Group */
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.radio-item input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Checkbox Grid */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    max-height: 200px;
    overflow-y: auto;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 13px;
}

.checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.checkbox-item.checked {
    background: #e3f2fd;
    padding: 5px;
    border-radius: 3px;
}

/* Selected Materials with Percentage */
.selected-materials {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.material-percentage-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 5px;
}

.material-percentage-row .material-name {
    flex: 1;
    font-size: 14px;
}

.material-percentage-row input {
    width: 80px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.material-percentage-row .btn-remove {
    width: 24px;
    height: 24px;
    font-size: 14px;
}

/* Buttons */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background 0.3s;
}

.btn-primary {
    background: #333;
    color: white;
}

.btn-primary:hover {
    background: #555;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-print {
    background: var(--brand-orange);
    color: white;
}

.btn-print:hover {
    background: var(--brand-orange-dark);
}

.btn-add {
    background: #28a745;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    margin-left: auto;
}

.btn-add:hover {
    background: #218838;
}

.btn-remove {
    background: #dc3545;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.btn-remove:hover {
    background: #c82333;
}

/* Product Code Row */
.product-code-row {
    align-items: center;
}

.code-separator {
    white-space: nowrap;
    color: #666;
    font-size: 12px;
}

.form-actions {
    text-align: center;
    margin-top: 30px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 10px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-body .form-group {
    margin-bottom: 15px;
}

.modal-body label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #ddd;
}

.modal-footer .btn {
    padding: 8px 20px;
    font-size: 14px;
}

/* Color Code Display */
.color-code {
    font-size: 11px;
    color: #666;
}
