/* ==========================================================================
   CSS Design System & Styles for Quote Generator
   Theme: Premium Sleek Dark Mode (UI) & Elegant White Print (PDF)
   ========================================================================== */

:root {
    /* UI Dark Theme Variables */
    --bg-main: #0b0f19;
    --bg-card: #111827;
    --bg-card-header: #1f2937;
    --bg-input: #1f2937;
    --border-color: #374151;
    --border-hover: #4b5563;
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --color-accent: #3b82f6; /* Modern Blue */
    --color-accent-hover: #2563eb;
    --color-accent-glow: rgba(59, 130, 246, 0.15);
    
    --color-success: #10b981; /* Emerald Green */
    --color-success-hover: #059669;
    --color-danger: #ef4444;
    --color-danger-hover: #dc2626;
    
    --sidebar-width: 260px;
    --transition-speed: 0.25s;
    --border-radius: 12px;
    
    /* PDF Print Variables (Standard Light A4) */
    --pdf-bg: #ffffff;
    --pdf-text-main: #0f172a;
    --pdf-text-muted: #475569;
    --pdf-border: #cbd5e1;
    --pdf-primary: #1e3a8a; /* Navy Blue */
    --pdf-secondary: #3b82f6; /* Accent Blue */
    --pdf-danger: #b91c1c;
}

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

body {
    font-family: 'Heebo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* App Container Layout */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: var(--sidebar-width);
    background-color: #070a13;
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    z-index: 10;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    padding: 0 8px;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--color-accent), var(--color-success));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

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

.brand-name {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.5px;
    background: linear-gradient(to left, #ffffff, #9ca3af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: right;
    transition: all var(--transition-speed) ease;
    width: 100%;
}

.nav-btn i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    transition: color var(--transition-speed) ease;
}

.nav-btn:hover {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.nav-btn.active {
    background-color: var(--color-accent-glow);
    color: var(--color-accent);
    font-weight: 700;
}

.nav-btn.active i {
    color: var(--color-accent);
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.version {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'Outfit', sans-serif;
}

/* Main Workspace */
.main-content {
    flex-grow: 1;
    height: 100vh;
    overflow-y: auto;
    background-color: var(--bg-main);
    position: relative;
}

/* Content Panels */
.content-panel {
    display: none;
    padding: 24px;
    min-height: 100%;
    animation: fadeIn 0.3s ease-in-out;
}

.content-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Headers */
.section-header {
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-header h2 i {
    color: var(--color-accent);
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Cards */
.section-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 20px;
    transition: border-color var(--transition-speed) ease;
}

.section-card:hover {
    border-color: var(--border-hover);
}

.card-header {
    background-color: var(--bg-card-header);
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.flex-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.card-body {
    padding: 20px;
}

/* Badges */
.badge {
    background-color: var(--border-hover);
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
}

.badge.active {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
}

/* Input layout with Scan button */
.input-with-button {
    display: flex;
    gap: 8px;
}

.input-with-button button {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
}

/* Forms & Inputs */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="password"],
select,
textarea {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 10px 14px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all var(--transition-speed) ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-glow);
}

textarea {
    resize: vertical;
}

textarea#ai-input {
    height: 140px;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.6;
}

.input-help {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.readonly-highlight {
    background-color: rgba(59, 130, 246, 0.08) !important;
    border-color: rgba(59, 130, 246, 0.4) !important;
    font-weight: 700;
    color: var(--color-accent) !important;
    font-size: 1.05rem !important;
    font-family: 'Outfit', 'Rubik', sans-serif !important;
}

/* File Uploader Styles */
.file-uploader-box {
    display: flex;
    gap: 8px;
    align-items: center;
}

.img-preview-box {
    width: 100%;
    height: 80px;
    margin-top: 8px;
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.2);
}

.img-preview-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Google Drive statuses */
.drive-conn-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
}

#drive-status {
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-disconnected {
    color: var(--color-danger);
}

.status-connected {
    color: var(--color-success);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-speed) ease;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-accent {
    background-color: var(--color-accent);
    color: white;
}

.btn-accent:hover {
    background-color: var(--color-accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.btn-success {
    background-color: var(--color-success);
    color: white;
}

.btn-success:hover {
    background-color: var(--color-success-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-secondary {
    background-color: var(--border-color);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-secondary:hover {
    background-color: var(--border-hover);
    color: white;
}

.btn-danger {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background-color: var(--color-danger);
    color: white;
}

/* Text Links */
.text-link {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--transition-speed) ease;
}

.text-link:hover {
    color: var(--color-accent-hover);
    text-decoration: underline;
}

.text-accent {
    color: var(--color-accent);
}

/* AI Panel Actions */
.ai-actions {
    display: flex;
    gap: 12px;
    margin-top: 14px;
}

/* Split View Creator */
.split-view {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 24px;
    height: calc(100vh - 48px);
}

.control-side {
    height: 100%;
    overflow-y: auto;
    padding-bottom: 40px;
}

.preview-side {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: #161e2e;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

/* Preview Toolbar */
.preview-toolbar {
    background-color: var(--bg-card-header);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
}

.preview-actions {
    display: flex;
    gap: 8px;
}

/* Dynamic Work Items Form Style */
.form-section {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    background-color: rgba(255, 255, 255, 0.02);
}

.section-subheader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.section-subheader h4 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

.work-item-form-row {
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
    position: relative;
    animation: slideIn 0.2s ease-in-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dynamic Form Grid with price input column */
.work-item-form-grid {
    display: grid;
    grid-template-columns: 35px 1fr 1.5fr 120px 40px;
    gap: 12px;
    align-items: center;
}

.row-index {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.95rem;
    text-align: center;
}

.row-inputs {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.item-price-input {
    font-family: 'Outfit', 'Rubik', sans-serif !important;
    font-weight: 600;
    color: var(--color-success) !important;
}

/* Stern Results Container Styles */
.stern-results-container {
    max-height: 480px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 2px;
}

.stern-result-card {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    transition: all var(--transition-speed) ease;
}

.stern-result-card:hover {
    border-color: var(--color-accent);
    background-color: rgba(59, 130, 246, 0.03);
}

.stern-card-info {
    flex-grow: 1;
}

.stern-card-desc {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.stern-card-unit {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.stern-card-action {
    display: flex;
    align-items: center;
    gap: 14px;
}

.stern-card-price {
    font-family: 'Outfit', 'Rubik', sans-serif;
    font-weight: 700;
    color: var(--color-success);
    font-size: 1.05rem;
    white-space: nowrap;
}

/* AI Pricing Helper Dashboard Results */
.ai-helper-results-box {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.01);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: slideIn 0.3s ease-out;
}

.results-price-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 6px;
    padding: 10px 14px;
}

.results-price-summary .lbl {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--color-success);
}

.results-price-summary .val {
    font-family: 'Outfit', 'Rubik', sans-serif;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--color-success);
}

.results-materials-header h5 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.helper-materials-checklist {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    padding: 10px;
}

.material-check-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.88rem;
    padding: 4px 6px;
    cursor: pointer;
    transition: background-color var(--transition-speed) ease;
    border-radius: 4px;
}

.material-check-row:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

.material-check-row input[type="checkbox"] {
    margin-top: 4px;
    cursor: pointer;
}

.material-check-text {
    flex-grow: 1;
}

.material-item-name {
    font-weight: 600;
    color: var(--text-primary);
}

.material-item-details {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.ai-helper-tips {
    background-color: rgba(239, 68, 68, 0.05);
    border-right: 3px solid var(--color-danger);
    border-radius: 0 4px 4px 0;
    padding: 10px 14px;
    font-size: 0.85rem;
    color: #f87171;
    font-weight: 500;
    white-space: pre-line;
    line-height: 1.5;
}

/* A4 Sheet Preview & Page */
.sheet-scroller {
    flex-grow: 1;
    overflow: auto;
    padding: 30px;
    display: flex;
    justify-content: center;
    background-color: #0f172a;
}

/* A4 dimensions: 210mm x 297mm */
.a4-sheet {
    background-color: var(--pdf-bg);
    color: var(--pdf-text-main);
    font-family: 'David Libre', 'Frank Ruhl Libre', 'Heebo', serif;
    width: 794px; /* A4 width at 96 DPI */
    min-height: 1123px; /* A4 height at 96 DPI */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    padding: 45px 50px; /* Layout margins */
    display: flex;
    flex-direction: column;
    position: relative;
    transform-origin: top center;
}

/* Watermark Overlay behind PDF content */
.pdf-watermark {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.06;
    pointer-events: none;
    z-index: 0;
    background-position: center center;
    background-repeat: no-repeat;
    background-size: contain;
    background-origin: content-box;
    padding: 80px; /* standard document margins */
}

.pdf-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    flex-grow: 1;
    position: relative;
    z-index: 1; /* Render text on top of the watermark */
}

/* PDF Elements Styling (Exactly matches print mockup) */
.pdf-header {
    width: 100%;
    margin-bottom: 6px;
}

.pdf-header-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1.2fr;
    align-items: flex-start;
    width: 100%;
    gap: 20px;
}

.pdf-recipient-column {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: right;
    align-items: flex-start;
}

.pdf-logo-column {
    display: flex;
    flex-direction: column;
    align-items: var(--logo-align, center);
    text-align: var(--logo-text-align, center);
    margin-top: var(--logo-margin-top, 0px);
    margin-bottom: var(--logo-margin-bottom, 10px);
}

.pdf-meta-column {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: left;
    gap: 6px;
    font-weight: 500;
}

.pdf-logo-wrapper {
    width: var(--logo-width, 75px);
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.pdf-logo-wrapper img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.pdf-logo-svg {
    width: 100%;
    height: 100%;
}

.pdf-company-title {
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--pdf-primary);
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.pdf-company-subtitle {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--pdf-secondary);
    border-bottom: 1.5px solid var(--pdf-secondary);
    display: inline-block;
    padding-bottom: 2px;
    margin-bottom: 2px;
    letter-spacing: 1px;
    min-width: 150px;
}

.pdf-company-owner {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--pdf-text-muted);
}

.pdf-header-divider {
    width: 100%;
    height: 1.5px;
    background-color: var(--pdf-secondary);
    margin-bottom: 20px;
    margin-top: 6px;
}

.recipient-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--pdf-text-muted);
}

.recipient-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--pdf-primary);
    text-decoration: underline;
    text-underline-offset: 4px;
    white-space: nowrap;
}

.recipient-sub {
    font-size: 0.95rem;
    color: var(--pdf-text-main);
    font-weight: 400;
    white-space: pre-line;
    line-height: 1.4;
}

.meta-val-date {
    font-size: 1.05rem;
    font-weight: 700;
    font-family: 'Outfit', 'Rubik', sans-serif;
    color: var(--pdf-text-main);
}

.meta-val-number {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--pdf-text-main);
}

.meta-val-number span {
    font-family: 'Outfit', 'Rubik', sans-serif;
}

.meta-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    white-space: nowrap;
}

.meta-lbl {
    font-weight: 700;
    color: var(--pdf-text-muted);
}

.meta-val {
    font-weight: 600;
    font-family: 'Outfit', 'Rubik', sans-serif;
    color: var(--pdf-text-main);
}

/* PDF Title Block */
.pdf-title-container {
    text-align: center;
    margin-bottom: 24px;
}

.pdf-title {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--pdf-primary);
    display: inline-block;
    padding-bottom: 6px;
    border-bottom: 2.5px solid var(--pdf-primary);
}

/* PDF Content */
.pdf-content-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.pdf-items-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-bottom: 30px;
}

.pdf-work-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    page-break-inside: avoid;
}

.pdf-item-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--pdf-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
    margin-bottom: 2px;
}

.pdf-item-desc {
    font-size: 0.95rem;
    color: var(--pdf-text-main);
    white-space: pre-line;
    padding-right: 12px;
    line-height: 1.6;
}

/* Detailed HTML Table inside PDF */
.pdf-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
    font-size: 0.95rem;
    page-break-inside: auto;
}

.pdf-table tr {
    page-break-inside: avoid;
    page-break-after: auto;
}

.pdf-table th,
.pdf-table td {
    border: 1.5px solid var(--pdf-border);
    padding: 10px 14px;
    text-align: right;
    vertical-align: top;
}

.pdf-table th {
    background-color: #f1f5f9;
    color: var(--pdf-primary);
    font-weight: 700;
}

.pdf-table tbody tr:nth-child(even) {
    background-color: #f8fafc;
}

/* Summary & Warning boxes */
.pdf-summary-box {
    background-color: #fafafa;
    border-right: 3px solid var(--pdf-secondary);
    padding: 12px 16px;
    margin-top: auto;
    margin-bottom: 12px;
    border-radius: 0 4px 4px 0;
    font-size: 0.9rem;
    page-break-inside: avoid;
}

.summary-title {
    font-weight: 700;
    color: var(--pdf-primary);
    margin-bottom: 4px;
}

.summary-text {
    color: var(--pdf-text-main);
    white-space: pre-line;
    line-height: 1.5;
}

.pdf-warning-box {
    color: var(--pdf-danger);
    font-weight: 700;
    text-align: center;
    border: 1px dashed var(--pdf-danger);
    background-color: rgba(239, 68, 68, 0.03);
    padding: 8px 12px;
    font-size: 0.9rem;
    border-radius: 6px;
    margin-bottom: 20px;
    page-break-inside: avoid;
}

/* PDF Footer Section */
.pdf-footer-section {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    page-break-inside: avoid;
}

.pdf-price-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--pdf-primary);
    margin-bottom: 2px;
}

.price-label {
    text-decoration: underline;
}

.price-val {
    font-family: 'Outfit', 'Rubik', sans-serif;
    font-size: 1.45rem;
    text-decoration: underline;
}

.price-sub-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--pdf-text-muted);
    margin-bottom: 24px;
}

.pdf-footer-line {
    width: 100%;
    height: 1.5px;
    background-color: var(--pdf-primary);
    margin-bottom: 12px;
}

.pdf-company-footer {
    width: 100%;
    text-align: center;
    font-size: 0.78rem;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.footer-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.font-bold {
    font-weight: 700;
    color: var(--pdf-text-main);
}

.text-secondary {
    color: var(--pdf-text-muted);
}

.bullet {
    color: var(--pdf-border);
}

.footer-notice {
    font-size: 0.65rem;
    color: var(--pdf-text-muted);
    margin-top: 6px;
    font-style: italic;
}

/* History Tab Table & Content */
.history-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 16px;
}

.search-bar {
    position: relative;
    flex-grow: 1;
    max-width: 400px;
}

.search-bar i {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-bar input {
    padding-right: 38px;
}

.history-actions {
    display: flex;
    gap: 10px;
}

.history-table-wrapper {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
    font-size: 0.95rem;
}

.history-table th,
.history-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
}

.history-table th {
    background-color: var(--bg-card-header);
    color: var(--text-secondary);
    font-weight: 700;
}

.history-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.history-table .actions-cell {
    display: flex;
    gap: 6px;
}

.empty-state {
    padding: 60px;
    text-align: center;
    color: var(--text-muted);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.empty-state i {
    font-size: 3rem;
    color: var(--border-color);
}

/* Settings Settings Layout */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 24px;
}

/* Notification Toast */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.toast {
    background-color: var(--bg-card);
    border-right: 4px solid var(--color-accent);
    color: var(--text-primary);
    padding: 14px 20px;
    border-radius: 6px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    min-width: 250px;
    animation: slideInRight 0.3s ease-out;
}

.toast.success {
    border-right-color: var(--color-success);
}

.toast.error {
    border-right-color: var(--color-danger);
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.fade-out {
    animation: fadeOut 0.3s forwards;
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateY(8px); }
}


/* ==========================================================================
   Active Project Banner
   ========================================================================== */
.active-project-banner {
    background-color: var(--bg-card-header);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    z-index: 5;
    position: sticky;
    top: 0;
}

.banner-label {
    font-weight: 700;
}

.banner-value {
    color: var(--text-primary);
    font-weight: 700;
}

.banner-badge {
    background-color: var(--color-accent-glow);
    color: var(--color-accent);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* ==========================================================================
   Chat Interface Styles
   ========================================================================== */
.chat-container {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    height: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--bg-card);
    overflow: hidden;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
    animation: fadeIn 0.25s ease-out;
}

.chat-bubble.user {
    align-self: flex-start;
    background-color: var(--color-accent);
    color: white;
    border-bottom-right-radius: 2px;
}

.chat-bubble.model, .chat-bubble.system {
    align-self: flex-end;
    background-color: var(--bg-card-header);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 2px;
}

.chat-bubble.system {
    background-color: rgba(59, 130, 246, 0.05);
    border-color: var(--color-accent);
    align-self: center;
    max-width: 90%;
    text-align: center;
    border-radius: 12px;
    font-size: 0.9rem;
}

.chat-suggestions {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    background-color: rgba(0, 0, 0, 0.15);
    border-top: 1px solid var(--border-color);
    overflow-x: auto;
    white-space: nowrap;
}

.chip {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.chip:hover {
    background-color: var(--border-hover);
    color: white;
    border-color: var(--color-accent);
}

.chat-input-area {
    display: flex;
    gap: 10px;
    padding: 16px;
    background-color: var(--bg-card-header);
    border-top: 1px solid var(--border-color);
}

.chat-input-area textarea {
    flex-grow: 1;
    resize: none;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 10px;
    font-size: 0.95rem;
}

.chat-input-area button {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    padding: 0;
    border-radius: 8px;
}

/* Typing Indicator Animation */
.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
    height: 20px;
    width: 40px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background-color: var(--text-muted);
    border-radius: 50%;
    animation: typing 1s infinite alternate;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    from { transform: translateY(0); }
    to { transform: translateY(-6px); }
}

/* ==========================================================================
   Projects Manager Styles
   ========================================================================== */
.projects-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: calc(100vh - 240px);
    overflow-y: auto;
    padding-left: 6px;
}

.project-card {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all var(--transition-speed) ease;
}

.project-card:hover {
    border-color: var(--color-accent);
    background-color: rgba(59, 130, 246, 0.02);
}

.project-card.active {
    border-color: var(--color-success);
    background-color: rgba(16, 185, 129, 0.02);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.1);
}

.project-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.project-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.project-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    gap: 12px;
}

.project-actions {
    display: flex;
    gap: 8px;
}

.no-price-col {
    grid-template-columns: 35px 1fr 1.5fr 40px !important;
}


/* ==========================================================================
   Collapsible Sliding Drawer (Stern Pricing)
   ========================================================================== */
.stern-drawer {
    position: fixed;
    top: 0;
    left: -400px;
    width: 380px;
    height: 100%;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.6);
    transition: left var(--transition-speed) ease-in-out;
    z-index: 150;
    display: flex;
    flex-direction: column;
}

.stern-drawer.open {
    left: 0;
}

.drawer-header {
    padding: 16px 20px;
    background-color: var(--bg-card-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.75rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    transition: color var(--transition-speed);
}

.btn-close:hover {
    color: white;
}

.drawer-search {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.1);
}

.drawer-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px;
}

/* ==========================================================================
   Print Styles for html2pdf.js
   ========================================================================== */
@media print {
    body * {
        visibility: hidden;
    }
    
    #quote-pdf-sheet,
    #quote-pdf-sheet * {
        visibility: visible;
    }
    
    #quote-pdf-sheet {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: auto;
        box-shadow: none;
        padding: 0;
        margin: 0;
    }
    
    .pdf-watermark {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ==========================================================================
   Mobile Responsive Design (iPhone 16 / Portrait Mobile)
   ========================================================================== */
@media (max-width: 768px) {
    body {
        overflow-y: auto; /* Allow scrolling the whole app on mobile if needed */
    }

    .app-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }

    /* Sidebar as Bottom Navigation Bar */
    .sidebar {
        width: 100%;
        height: 65px;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        flex-direction: row;
        justify-content: space-around;
        padding: 6px 4px;
        background-color: #070a13;
        border-top: 1px solid var(--border-color);
        border-left: none;
        z-index: 1000;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
    }

    .sidebar-logo,
    .sidebar-footer {
        display: none !important;
    }

    .nav-menu {
        flex-direction: row;
        justify-content: space-around;
        width: 100%;
        gap: 2px;
    }

    .nav-btn {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 4px;
        font-size: 0.72rem;
        text-align: center;
        width: auto;
        flex-grow: 1;
        background: none;
        border-radius: 6px;
        color: var(--text-secondary);
    }

    .nav-btn i {
        font-size: 1.2rem;
        width: auto;
        margin: 0;
    }

    .nav-btn.active {
        background-color: transparent;
        color: var(--color-accent);
    }

    /* Main Content Adjustments */
    .main-content {
        height: auto;
        min-height: calc(100vh - 65px);
        padding-bottom: 75px; /* Margin to not get hidden by bottom navigation */
        overflow-y: visible;
    }

    .content-panel {
        padding: 12px;
        animation: none; /* Disable animations on mobile for performance */
    }

    /* Split View Stack */
    .split-view {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto;
        gap: 16px;
        height: auto;
    }

    .control-side {
        height: auto;
        overflow-y: visible;
        padding-bottom: 0;
    }

    .preview-side {
        height: auto;
        min-height: 480px;
    }

    /* Form and Grid scaling */
    .form-grid-2, 
    .form-grid-3 {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    /* Active Project Banner wrapping */
    .active-project-banner {
        font-size: 0.85rem;
        padding: 10px 14px;
        flex-wrap: wrap;
        gap: 6px;
        position: relative;
    }

    /* Stern Pricing Drawer width on mobile */
    .stern-drawer {
        width: 100%;
        left: -100%;
    }

    .stern-drawer.open {
        left: 0;
    }

    /* Chat log height constraints on mobile */
    .chat-container {
        height: 450px;
    }

    /* Watermark scroller centering on mobile */
    .sheet-scroller {
        padding: 10px;
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Form Rows with checkboxes */
    .work-item-form-grid {
        grid-template-columns: 1fr !important;
        gap: 8px;
        padding: 10px;
    }

    .work-item-form-grid.no-price-col {
        grid-template-columns: 1fr !important;
    }

    .work-item-form-row {
        position: relative;
        padding-bottom: 40px; /* space for absolute delete button on mobile */
    }

    .work-item-form-row .btn-danger {
        position: absolute;
        bottom: 8px;
        left: 8px;
        width: calc(100% - 16px) !important;
        height: 34px !important;
    }

    .row-index {
        display: none; /* Hide indices to save horizontal space on mobile */
    }
}
