:root {
    --primary: #2563EB;
    --primary-hover: #1D4ED8;
    --bg-body: #F8F9FA;
    --bg-card: #FFFFFF;
    --text-main: #1F2937;
    --text-muted: #6B7280;
    --border-color: #E5E7EB;

    --a4-w: 210mm;
    --a4-h: 297mm;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: #e0e5ec;
    height: 100vh;
    overflow: hidden;
}

/* APP LAYOUT */
.app-container {
    display: flex;
    height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: 380px;
    background: white;
    padding: 24px;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-header {
    margin-bottom: 30px;
}

.back-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 20px;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--primary);
}

.sidebar h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
}

.form-section {
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 24px;
    margin-bottom: 4px;
}

.form-section h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 20px;
    font-weight: 700;
}

.form-group {
    margin-bottom: 16px;
}

.row {
    display: flex;
    gap: 12px;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-main);
}

input[type="text"],
input[type="number"],
input[type="tel"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: all 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* File Upload Minimal */
.file-upload-input {
    display: none;
}

.file-upload-label {
    background: #F9FAFB;
    border: 1px dashed var(--border-color);
    padding: 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.file-upload-label:hover {
    border-color: var(--primary);
    background: #EFF6FF;
    color: var(--primary);
}

/* Dynamic Lots */
.lot-item-editor {
    background: #F9FAFB;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    position: relative;
    border: 1px solid var(--border-color);
}

.btn-add-lot {
    background: var(--primary);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.btn-remove-lot {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #FEE2E2;
    color: #DC2626;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sub-rows-container {
    margin-top: 10px;
}

.sub-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.lot-qty {
    flex: 1;
}

.btn-add-line {
    background: #ECFDF5;
    color: #059669;
    border: 1px solid #10B981;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 20px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* PREVIEW AREA */
.preview-area {
    flex: 1;
    background: #555;
    flex: 1;
    background: #555;
    position: relative;
    overflow: hidden;
    /* Removed flex centering to handle manually via JS transform */
}

/* A4 SHEET*/
.sheet-a4 {
    width: var(--a4-w);
    height: var(--a4-h);
    background: white;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    position: absolute;
    /* CSS Centering */
    top: 50%;
    left: 50%;
    transform-origin: center center;
    /* Translate will be added via JS or initial state, we need it to default centered */
    transform: translate(-50%, -50%);
    overflow: hidden;
}

/* LOGO WRAP */
.logo-wrap {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 140px;
    height: 80px;
    background: white;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.logo-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.logo-placeholder {
    font-size: 10px;
    color: #ccc;
    font-weight: 800;
}

/* TOP ZONE */
.top-zone {
    width: 100%;
    height: 48%;
    background: #f3f4f6;
    position: relative;
    z-index: 1;
    overflow: hidden;
    /* Prevent overflow */
}

.main-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.main-img[src] {
    display: block;
}

.main-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-weight: 800;
    font-size: 1.5rem;
}

/* BOTTOM ZONE */
.bottom-zone {
    flex: 1;
    display: flex;
    padding: 0 12mm 10mm 12mm;
    position: relative;
}

.col-left {
    flex: 1;
    padding-right: 20px;
    padding-top: 30px;
    display: flex;
    flex-direction: column;
}

.project-title {
    font-family: 'Oswald', sans-serif;
    font-size: 28pt;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 5px;
    line-height: 1.1;
    color: #000;
}

.project-location {
    font-size: 11pt;
    color: #6B7280;
    margin-bottom: 30px;
    font-weight: 500;
}

.separator-line {
    width: 100%;
    height: 1px;
    background: #E5E7EB;
    margin: 10px 0;
}

.label {
    display: block;
    font-size: 12pt;
    font-weight: 800;
    color: #000;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.label-small {
    font-size: 10pt;
}

.value {
    display: block;
    font-size: 11pt;
    color: #374151;
}

.lots-list {
    list-style: none;
    margin-top: 15px;
}

.lots-list li {
    font-size: 11pt;
    margin-bottom: 12px;
    padding-left: 15px;
    border-left: 5px solid var(--theme-color, #2d3436);
    line-height: 1.3;
}

.lots-list li strong {
    display: block;
    color: #000;
    text-transform: uppercase;
    font-weight: 800;
    font-size: 0.9em;
    margin-bottom: 2px;
}

.lots-list li div {
    font-size: 0.9em;
    color: #4B5563;
}

/* RIGHT COL IMAGES */
.col-right {
    width: 44%;
    display: flex;
    flex-direction: column;
    margin-top: -60px;
    z-index: 10;
    padding-left: 10px;
}

.sec-img-box {
    width: 100%;
    aspect-ratio: 4/3;
    background: white;
    position: relative;
    border: 8px solid white;
    /* box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); Removed shadow */
    margin-bottom: -15px;
    overflow: hidden;
    /* Ensure no overflow */
}

.sec-img-box:nth-child(2) {
    z-index: 9;
}

.sec-img-box:nth-child(3) {
    z-index: 8;
    margin-bottom: 0;
}

.sec-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.sec-img[src] {
    display: block;
}

.sec-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    color: #ccc;
    font-size: 10px;
    font-weight: 800;
}

/* TABS */
.tabs-container {
    position: absolute;
    top: 50%;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 20;
    transform: translateY(-50%);
}

.tab-item {
    background: var(--theme-color, #2d3436);
    color: white;
    writing-mode: vertical-rl;
    padding: 15px 8px;
    font-size: 8pt;
    font-weight: 800;
    text-transform: uppercase;
    border-radius: 6px 0 0 6px;
    letter-spacing: 1px;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
}

/* PRINT */
@media print {
    .no-print {
        display: none;
    }

    .sheet-a4 {
        box-shadow: none;
        width: 100%;
        height: 100%;
        margin: 0;
        border: none;
        transform: none !important;
    }

    .preview-area {
        padding: 0;
        background: white;
    }

    @page {
        margin: 0;
        size: A4;
    }
}