@page { size: A4; margin: 0; }

/* A4 Page (New Template - Print/Preview) */
.a4-page {
    width: 210mm;
    height: 297mm;
    overflow: hidden;
    margin: 0 auto;
    background: white;
    padding: 15mm;
    box-shadow: 0 0 15px rgba(0,0,0,0.1);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
    margin-bottom: 20px;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.a4-page * {
    box-sizing: border-box;
}

.content-wrapper {
    flex: 1;
}

.footer-wrapper {
    margin-top: auto;
}

/* SECTION 1: COMPANY HEADER */
.header {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 2px solid #333;
}

.logo-wrapper {
    flex: 0 0 auto;
    align-self: stretch;
    display: flex;
}

.logo-placeholder {
    border: 2px solid #333;
    border-radius: 4px;
    height: 100%;
    aspect-ratio: 1 / 1;
    background-image: url('../../logo.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #fff;
}

.company-details {
    flex: 1;
    display: block;
    text-align: right;
}

.company-name {
    font-size: 22px;
    font-weight: bold;
    color: #000;
    margin-bottom: 5px;
    text-transform: none;
}

.company-info {
    font-size: 11px;
    line-height: 1.4;
    color: #333;
}

/* SECTION 2: REFERENCE INFO */
.ref-section {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 12px;
    padding: 8px 0;
}

.ref-left, .ref-right {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ref-item {
    display: inline;
}

.label {
    font-weight: bold;
    margin-right: 5px;
    color: #000;
    text-transform: none;
    font-size: inherit;
    letter-spacing: normal;
}

/* SECTION 3: QUOTATION TITLE */
.quotation-title {
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    margin: 10px 0 8px 0;
    padding: 10px 20px;
    background: #333;
    color: white;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* SECTION 4: INTRO TEXT */
.intro-text {
    font-size: 12px;
    margin-bottom: 8px;
}

/* SECTION 5: ITEMS TABLE */
.items-container {
    margin-bottom: 10px;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.items-table thead {
    background: #f8f8f8;
}

.items-table th {
    padding: 10px 6px;
    text-align: left;
    font-weight: bold;
    border: 1px solid #333;
    background: #e0e0e0;
    font-size: 13px;
}

.items-table td {
    padding: 8px 6px;
    border: 1px solid #ddd;
    vertical-align: top;
    font-size: 12px;
    line-height: 1.4;
}

.items-table tr:nth-child(even) {
    background: #f9f9f9;
}

/* SECTION 6A: NOTE */
.note-section {
    font-size: 12px;
    margin-bottom: 10px;
    padding: 10px;
    background: #f9f9f9;
    border-left: 3px solid #666;
    color: #333;
    border-radius: 0;
}

.note-section strong {
    font-weight: bold;
}

/* SECTION 6B: TERMS & CONDITIONS */
.terms-section {
    font-size: 11px;
    margin-bottom: 10px;
    color: #333;
}

.terms-section h3 {
    font-size: 13px;
    margin-bottom: 10px;
    font-weight: bold;
    color: #333;
}

.terms-section ol {
    margin-left: 20px;
    line-height: 1.8;
}

/* SECTION 6C: FOOTER (ISO & Page Number) */
.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
    font-style: italic;
    margin-top: auto;
    color: #333;
    flex-shrink: 0;
}

@media print {
    body { background: none; }
    .a4-page { box-shadow: none; transform: none !important; margin: 0; }
    .controls { display: none; }
}

/* CONTROLS */
.controls {
    text-align: center;
    margin-bottom: 20px;
}

.btn {
    padding: 10px 20px;
    margin: 0 5px;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    font-size: 14px;
}

.btn-add {
    background: #4CAF50;
    color: white;
}

.btn-remove {
    background: #f44336;
    color: white;
}

.btn:hover {
    opacity: 0.8;
}
