:root {
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --border-color: #e5e7eb;
    --accent-color: #000000;
    --accent-hover: #333333;
    --radius-md: 8px;
    --radius-lg: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
}

/* App Layout */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.header p {
    color: var(--text-secondary);
}

.main-content {
    display: flex;
    gap: 3rem;
    align-items: flex-start;
}

/* Form Section */
.form-section {
    flex: 1;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 1.25rem;
}

.product-input-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.product-input-row .prod-name {
    flex: 3;
}
.product-input-row .prod-qty {
    flex: 1;
}
.product-input-row .prod-price {
    flex: 2;
}

label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

input, select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.divider {
    border: 0;
    height: 1px;
    background: var(--border-color);
    margin: 1.5rem 0;
}

h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* Buttons */
.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.btn {
    flex: 1;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-primary {
    background-color: var(--accent-color);
    color: #fff;
}
.btn-primary:hover {
    background-color: var(--accent-hover);
}
.btn-secondary {
    background-color: #f3f4f6;
    color: var(--text-primary);
}
.btn-secondary:hover {
    background-color: #e5e7eb;
}

/* Preview Section */
.preview-section {
    flex: 1;
    position: sticky;
    top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.preview-container {
    background: #e5e7eb;
    padding: 2rem;
    border-radius: var(--radius-lg);
    display: flex;
    justify-content: center;
    width: 100%;
}

/* Label Styling (Screen and Print) */
.label {
    background: #fff;
    width: 3in;
    height: 4in;
    padding: 0.1in 0.15in;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    font-family: 'Inter', sans-serif;
    color: #000;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.label-header {
    text-align: center;
    margin-bottom: 0.05in;
}

.brand-logo-text {
    font-family: 'Zen Dots', sans-serif;
    font-size: 20pt;
    color: #111;
    letter-spacing: -1px;
}

.label-details {
    text-align: center;
    margin-bottom: 0.08in;
}

.parcel-id-block {
    margin-bottom: 0.05in;
}

.parcel-label {
    font-size: 7pt;
    font-weight: 600;
    letter-spacing: 0.5px;
    display: block;
    color: #333;
}

.parcel-value {
    font-size: 16pt;
    font-weight: 700;
    line-height: 1.1;
}

.customer-info {
    font-size: 10pt;
    line-height: 1.3;
}

.invoice-section {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 0.05in;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 8pt;
    margin-bottom: 0.05in;
    border-top: 1px solid #000;
}

.invoice-table th, .invoice-table td {
    padding: 2px 0;
    text-align: left;
}
.invoice-table th {
    font-weight: 600;
    border-bottom: 1px solid #000;
}
.invoice-table .col-prod { width: 60%; }
.invoice-table .col-qty { width: 15%; text-align: center; }
.invoice-table .col-price { width: 25%; text-align: right; }

.invoice-table td.col-qty { text-align: center; }
.invoice-table td.col-price { text-align: right; }

.invoice-summary {
    font-size: 8pt;
    margin-top: auto;
    padding-top: 0.05in;
    border-top: 1px solid #000;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
}

.cod-section {
    border-top: 2px solid #000;
    border-bottom: 2px solid #000;
    padding: 0.08in 0;
    text-align: center;
    margin-bottom: 0.08in;
    background: #f9f9f9;
}

.cod-label {
    font-size: 16pt;
    font-weight: 700;
    line-height: 1;
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 4px;
}
.tk-symbol {
    font-family: sans-serif;
    font-size: 14pt;
}

.label-footer {
    text-align: center;
    font-size: 8pt;
    margin-top: auto;
    padding-bottom: 2px;
}
.thank-you {
    font-weight: 600;
}
.separator {
    margin: 0 4px;
    color: #666;
}
.website {
    font-weight: 500;
}

/* Print CSS */
@media print {
    @page {
        size: 3in 4in;
        margin: 0;
    }

    body {
        margin: 0;
        padding: 0;
        background: #fff;
    }

    /* Hide non-printable elements */
    .header,
    .form-section,
    .preview-section h2 {
        display: none !important;
    }

    /* Reset containers to ensure label is at the top left */
    .app-container,
    .main-content,
    .preview-section,
    .preview-container {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: none !important;
        background: transparent !important;
        box-shadow: none !important;
        position: static !important;
    }

    .label {
        width: 3in;
        height: 4in;
        margin: 0;
        padding: 0.1in 0.15in;
        box-shadow: none;
        border: none;
        background: #fff;
        position: static;
    }

    .cod-section {
        background: transparent;
        border-top: 2px solid #000;
        border-bottom: 2px solid #000;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
