/* Hanson Invoice Styles */
:root {
    --primary-color: #D6452D;
    --text-color: #333;
    --light-gray: #f9f9f9;
    --border-color: #ddd;
    --white: #ffffff;
    --a4-width: 210mm;
    --a4-height: 297mm;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f2f5;
    color: var(--text-color);
    line-height: 1.6;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Form Styles */
.form-container {
    width: 350px;
    background-color: var(--white);
    padding: 2rem;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.form-header h2 {
    color: var(--primary-color);
    margin-bottom: 2rem;
    font-size: 1.5rem;
}

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

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

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

input, select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 1rem;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #b53a26;
}

/* Preview Styles */
.preview-container {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 3rem;
    background-color: #525659;
    overflow-y: auto;
}

.a4-page {
    width: var(--a4-width);
    min-height: var(--a4-height);
    background-color: var(--white);
    padding: 20mm;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
    position: relative;
}

/* Invoice Header */
.invoice-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3rem;
}

.logo-container {
    flex: 1;
}

.main-logo {
    max-width: 250px;
    height: auto;
}

.company-info {
    text-align: right;
    font-size: 0.9rem;
    line-height: 1.4;
}

#title-factura {
    color: var(--primary-color);
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
}

/* Invoice Meta (Invoice Num, Data) */
.invoice-meta {
    margin-bottom: 2rem;
    border-top: 2px solid var(--primary-color);
    padding-top: 1rem;
}

.meta-row {
    display: flex;
    gap: 3rem;
}

.meta-item .label {
    font-weight: 700;
    margin-right: 0.5rem;
}

/* Client & Reference Grid */
.client-reference-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 3rem;
}

.box-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 800;
    color: #666;
    margin-bottom: 5px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 2px;
}

.box-content {
    font-size: 1rem;
    white-space: pre-line;
}

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

.invoice-table th {
    background-color: var(--primary-color);
    color: white;
    padding: 10px;
    text-align: left;
    font-weight: 700;
    text-transform: uppercase;
}

.invoice-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border-color);
}

.text-center { text-align: center; }
.text-right { text-align: right; }

/* Totals Box */
.invoice-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.bank-info {
    font-size: 0.85rem;
    color: #555;
    max-width: 50%;
}

.totals-box {
    width: 300px;
    border-top: 1px solid var(--primary-color);
    padding-top: 5px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
}

.grand-total {
    background-color: var(--primary-color);
    color: white;
    padding: 10px;
    margin-top: 10px;
    font-weight: 800;
    font-size: 1.1rem;
}

/* Print Styles */
@media print {
    body {
        background-color: white;
    }

    .no-print {
        display: none !important;
    }

    .app-container {
        display: block;
    }

    .preview-container {
        padding: 0;
        background-color: white;
        overflow: visible;
    }

    .a4-page {
        width: 100%;
        box-shadow: none;
        padding: 0;
        margin: 0;
    }

    @page {
        size: A4;
        margin: 15mm;
    }
}
