:root {
    --primary-yellow: #f4c415;
    /* From style example */
    --primary-dark: #1f2022;
    /* From style example */
    --secondary-dark: #434445;
    /* From style example */
    --text-light: #ffffff;
    --text-muted: #888888;
    --border-color: #e0e0e0;
    --bg-app: #f5f7fa;
    --surface-white: #ffffff;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-app);
    color: var(--primary-dark);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    height: 100vh;
    width: 100vw;
}

/* --- Control Panel (Sidebar) --- */
.control-panel {
    background-color: var(--surface-white);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow-soft);
    z-index: 10;
}

.brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.brand p {
    font-size: 0.875rem;
    color: var(--secondary-dark);
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 3rem 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background-color: #fafafa;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary-yellow);
    background-color: rgba(244, 196, 21, 0.05);
}

.icon-upload {
    color: var(--secondary-dark);
    margin-bottom: 1rem;
}

.upload-zone h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.upload-zone p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Status & Buttons */
.status-panel {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.status-item .label {
    color: var(--secondary-dark);
}

.status-item .value.success {
    color: #28a745;
}

.status-item .value.error {
    color: #dc3545;
}

.primary-btn {
    background-color: var(--primary-yellow);
    color: var(--primary-dark);
    border: none;
    border-radius: 6px;
    padding: 0.875rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: transform 0.2s, background-color 0.2s;
}

.primary-btn:hover:not(:disabled) {
    background-color: #e0b20c;
    transform: translateY(-1px);
}

.primary-btn:disabled {
    background-color: #e0e0e0;
    color: #a0a0a0;
    cursor: not-allowed;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.secondary-btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--secondary-dark);
    border-radius: 6px;
    padding: 0.75rem;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.secondary-btn-outline:hover {
    background-color: #f8f9fa;
    border-color: var(--secondary-dark);
}

.value.warning {
    color: #fd7e14;
    font-weight: 600;
}

/* Features List */
.features-list h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

.features-list ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.features-list li {
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--secondary-dark);
}

.features-list li svg {
    color: #28a745;
}

/* Privacy Badge */
.privacy-badge {
    background-color: rgba(40, 167, 69, 0.08);
    border: 1px solid rgba(40, 167, 69, 0.3);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #1e4627;
}

.privacy-badge svg {
    color: #28a745;
}

.privacy-text {
    display: flex;
    flex-direction: column;
}

.privacy-text strong {
    font-size: 0.875rem;
}

.privacy-text span {
    font-size: 0.75rem;
    color: #666;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
}

.experiment-link {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
    font-weight: 500;
}

.experiment-link:hover {
    color: var(--primary-yellow);
}

/* --- Preview Panel (Main Area) --- */
.preview-panel {
    background-color: var(--secondary-dark);
    padding: 3rem;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* --- A4 Invoice Styles --- */
.invoice-a4 {
    background: white;
    width: 210mm;
    min-height: 297mm;
    padding: 15mm 20mm;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    color: #333;
}

/* Header */
.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 3rem;
    border-bottom: 2px solid var(--primary-yellow);
    padding-bottom: 1.5rem;
}

.logo-placeholder {
    width: 120px;
    height: 48px;
    background-color: var(--primary-dark);
    color: var(--primary-yellow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: 2px;
}

.invoice-title {
    text-align: right;
}

.invoice-title h2 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--secondary-dark);
    letter-spacing: -1px;
    margin: 0;
    line-height: 1;
}

.invoice-number {
    font-size: 1.1rem;
    color: var(--primary-yellow);
    font-weight: 600;
    display: block;
    margin-top: 0.5rem;
}

/* Meta Grid */
.invoice-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 3rem;
}

.meta-block h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.highlight-text {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-dark);
    margin-bottom: 0.25rem;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 0.25rem;
}

.meta-row .label {
    color: var(--secondary-dark);
    font-weight: 500;
}

.meta-row .val {
    font-weight: 600;
}

/* Table */
.items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 3rem;
}

.items-table th {
    text-align: left;
    padding: 1rem 0.5rem;
    background-color: var(--primary-dark);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}

.items-table th:first-child {
    border-radius: 4px 0 0 4px;
    padding-left: 1rem;
}

.items-table th:last-child {
    border-radius: 0 4px 4px 0;
    padding-right: 1rem;
    text-align: right;
}

.items-table td {
    padding: 1rem 0.5rem;
    border-bottom: 1px solid #eee;
}

.items-table td:first-child {
    padding-left: 1rem;
}

.items-table td:last-child {
    padding-right: 1rem;
    text-align: right;
    font-weight: 600;
}

.col-qty,
.col-unit,
.col-tax {
    width: 10%;
    text-align: center !important;
}

.col-total {
    width: 15%;
}

/* Footer Grid */
.invoice-footer-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    margin-top: auto;
    align-items: flex-start;
}

.payment-section {
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    align-items: flex-start;
}

.payment-info {
    background-color: #f9f9f9;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary-yellow);
    flex: 1;
}

.barcode-container {
    background: white;
    padding: 0.5rem;
    border: 1px solid #eee;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 200px;
    /* Fixed width for standard HUB3 size visualization */
}

.barcode-container canvas {
    max-width: 100%;
}

.barcode-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    text-transform: uppercase;
}

.detail-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.detail-row span:first-child {
    font-weight: 600;
    min-width: 80px;
}

.totals-block {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    font-size: 0.95rem;
}

.total-row.grand-total {
    border-top: 2px solid var(--primary-dark);
    margin-top: 0.5rem;
    padding-top: 1rem;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary-yellow);
    background-color: var(--primary-dark);
    padding: 1rem;
    border-radius: 4px;
}

.legal-footer {
    margin-top: 3rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.7rem;
    border-top: 1px solid #eee;
    padding-top: 1rem;
}