/* report-styles.css - Shared styles for StrucTalogue HTML-to-PDF Reports */

/* Import Roboto to match the jsPDF output exactly */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700;900&display=swap');

.pdf-container-dynamic, .pdf-container { 
    width: 750px; 
    background: white; 
    padding: 40px; 
    box-sizing: border-box; 
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; 
    color: #334155; 
    margin: 0 auto; 
}

/* 0. HEADER STYLING */
.rpt-header { 
    border-bottom: 1.5px solid #0f172a; 
    padding-bottom: 12px; 
    margin-bottom: 24px; 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-end; 
}

.rpt-logo { 
    font-size: 24px; /* Matches 18pt in jsPDF */
    font-weight: 700; 
    color: #0f172a; 
    text-transform: uppercase; 
    letter-spacing: 0px; 
    line-height: 1;
}

.rpt-meta { 
    text-align: right; 
    font-size: 12px; /* Matches 9pt in jsPDF */
    color: #64748b; 
    line-height: 1.4; 
}

/* Rounded Rectangle Information Grid */
.rpt-info-grid { 
    background: #f8fafc; 
    border: 1px solid #e2e8f0; 
    border-radius: 4px; 
    padding: 16px; 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 16px; 
    margin-bottom: 32px; 
}

.rpt-label { 
    font-size: 11px; /* Matches 8pt in jsPDF */
    text-transform: uppercase; 
    color: #64748b; 
    font-weight: 700; 
    display: block; 
    margin-bottom: 4px; 
}

.rpt-val { 
    font-weight: 400; 
    color: #334155; 
    font-size: 13.5px; /* Matches 10pt in jsPDF */
}

/* SECTION CONTAINERS & TITLES */
.rpt-section { 
    margin-bottom: 25px; 
    page-break-inside: avoid; 
}

.rpt-title { 
    font-size: 15px; /* Matches 11pt in jsPDF */
    font-weight: 700; 
    color: #3b82f6; /* Signature accent blue */
    border-bottom: none; /* Removed old underline */
    padding-bottom: 0; 
    margin-bottom: 12px; 
    text-transform: uppercase; 
}

/* TABLES - Styled like Section 2 */
.rpt-table { 
    width: 100%; 
    border-collapse: collapse; 
    font-size: 11.5px; /* Matches 8.5pt in jsPDF */
    margin-bottom: 15px;
}

.rpt-table th { 
    text-align: left; 
    background: #f8fafc; /* Clean light slate background */
    padding: 8px 10px; 
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0; 
    color: #0f172a; /* Dark slate text */
    font-weight: 700;
}

.rpt-table td { 
    padding: 8px 10px; 
    border-bottom: 1px solid #e2e8f0; 
    color: #334155; 
}

/* RESULTS & DIAGRAMS */
.rpt-res { 
    font-weight: 700; 
    color: #3b82f6; 
}

.rpt-res.pass { color: #22c55e; } /* Optional helper classes */
.rpt-res.fail { color: #ef4444; }

.rpt-diagram-box { 
    text-align: center; 
    margin: 20px 0; 
    padding: 10px; 
    border: 1px solid #e2e8f0; 
    border-radius: 4px; 
    background: #ffffff;
}

/* --- BOQ & TABLE SPECIFIC STYLES --- */

/* Page Headers */
.header-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.5rem; }
.back-link { display: flex; align-items: center; gap: 0.5rem; color: #64748b; text-decoration: none; font-size: 0.9rem; margin-bottom: 1rem; font-weight: 500; cursor: pointer;}
.back-link:hover { color: var(--accent); }

/* KPI Cards */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi-card { background: var(--surface); border: 1px solid var(--border); border-radius: 0.75rem; padding: 1.25rem; }
.kpi-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; color: var(--text-light); letter-spacing: 0.5px; }
.kpi-val { font-size: 1.5rem; font-weight: 700; margin-top: 0.5rem; color: var(--text); }
.kpi-val.cost { color: var(--accent); }
.kpi-val.carbon { color: #16a34a; }

/* Toolbar */
.toolbar { display: flex; justify-content: space-between; align-items: center; background: var(--surface); padding: 0.75rem; border: 1px solid var(--border); border-radius: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; gap: 1rem; }
.toolbar-group { display: flex; gap: 0.5rem; align-items: center; }
.filter-select { padding: 0.5rem; border: 1px solid var(--border); border-radius: 0.375rem; background: var(--bg); color: var(--text); font-size: 0.9rem; }
.btn-tool { padding: 0.5rem 1rem; border-radius: 0.375rem; font-size: 0.9rem; font-weight: 600; cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--text); display: flex; align-items: center; gap: 0.5rem; transition: all 0.2s;}
.btn-tool:hover { background: #f1f5f9; border-color: #cbd5e1; }
.btn-primary { background: var(--accent); color: white; border: none; }
.btn-primary:hover { background: #1d4ed8; }

/* Interactive Table */
.table-wrapper { background: var(--surface); border: 1px solid var(--border); border-radius: 0.75rem; overflow: hidden; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); margin-bottom: 3rem; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 1rem; border-bottom: 1px solid var(--border); }
th { background: #f8fafc; color: #64748b; font-weight: 600; font-size: 0.85rem; text-transform: uppercase; }
td { font-size: 0.95rem; vertical-align: middle; }

/* Dark Mode Table Overrides */
[data-theme="dark"] th { background: #0f172a; }
[data-theme="dark"] .row-subtotal td, [data-theme="dark"] .row-contingency td { background: #1e293b; }
[data-theme="dark"] .row-total td { background: #0f172a; }

/* Inputs inside tables */
input.editable { background: transparent; border: 1px solid transparent; padding: 0.4rem; border-radius: 4px; font-family: inherit; font-size: inherit; color: inherit; width: 100%; box-sizing: border-box; transition: 0.2s; }
input.editable:hover, input.editable:focus { background: var(--bg); border-color: var(--accent); outline: none; }
input.num-input { text-align: right; width: 80px; }

/* Tags */
.tag { padding: 0.25rem 0.5rem; border-radius: 4px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; }
.tag-auto { background: #e0f2fe; color: #0284c7; }
.tag-manual { background: #fef9c3; color: #a16207; }

/* Table Footer Rows */
.row-subtotal td, .row-contingency td { background: #f8fafc; font-weight: 600; color: #64748b; border-bottom: none; }
.row-total td { background: var(--surface); border-top: 2px solid var(--border); font-weight: 800; font-size: 1.1rem; color: var(--primary); }

/* Responsive adjustments for BOQ Table */
@media (max-width: 850px) {
    .header-row { flex-direction: column; gap: 1rem; }
    .table-wrapper { overflow-x: auto; }
}
