/* --- GENERAL & LAYOUT STYLES --- */
body { margin: 0; padding: 0; font-family: "Libre Franklin", sans-serif; background-color: #f8f9fa; color: #212529; }
h1, h2, h3 { margin: 0; }
button, .knop { padding: 10px 15px; border: 2px solid black; border-radius: 10px; font-family: "Libre Franklin", sans-serif; font-size: 14px; background: #e9ecef; color: black; text-decoration: none; cursor: pointer; transition: all 0.2s; }
button.button-primary { background-color: #0d6efd; color: white; border-color: #0d6efd; }
button.button-primary:hover { background-color: #0b5ed7; border-color: #0a58ca; }
button:hover, .knop:hover { background-color: #dee2e6; }
button:disabled { background-color: #e9ecef; border-color: #ced4da; color: #6c757d; cursor: not-allowed; }
.header { padding: 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid black; background-color: #fff; }
.header div { display: flex; gap: 10px; }
.main-content { display: flex; height: calc(100vh - 83px); }

/* --- LOGIN PAGE STYLES --- */
.login-wrapper { display: flex; align-items: center; justify-content: center; width: 100vw; height: 100vh; }
.login-box { background: #fff; padding: 40px; border-radius: 8px; border: 1px solid #dee2e6; box-shadow: 0 4px 12px rgba(0,0,0,0.08); width: 100%; max-width: 400px; }
.login-box h1 { text-align: center; margin-bottom: 25px; }
#loginButton { width: 100%; padding: 12px; font-size: 16px; }
.logout-btn { background-color: #6c757d; border-color: #6c757d; color: white; }
.logout-btn:hover { background-color: #5a6268; border-color: #545b62; }

/* --- UI MESSAGES --- */
.message-area { margin-top: 15px; font-weight: 500; min-height: 1.2em; }
.message-area.success { color: #198754; }
.message-area.error { color: #dc3545; }
.message-area.info { color: #0d6efd; }
.message-area.warning { color: #ffc107; font-weight: bold; }

/* --- PAGE CONTAINER (for SPA functionality) --- */
.page-container { display: none; width: 100%; height: calc(100vh - 83px); overflow-y: auto; }
.page-container.active { display: flex; flex-direction: column; }

/* --- GENERATOR PAGE STYLES --- */
.left-panel { padding: 20px; width: 388px; background-color: #fff; border-right: 1px solid black; display: flex; flex-direction: column; flex-shrink: 0; }
.left-panel-content { flex-grow: 1; overflow-y: auto; min-height: 0; }
.right-panel { width: 100%; overflow-y: auto; }
#dropZone { width: 100%; box-sizing: border-box; border: 2px dashed #adb5bd; padding: 20px; text-align: center; border-radius: 20px; cursor: pointer; background: #f8f9fa; transition: background-color 0.2s, border-color 0.2s; }
#dropZone.dragover { background-color: #e2e6ea; border-color: #0d6efd; }
#dropZone p { max-width: 240px; margin: auto; }
#invoiceSettingsContainer hr { margin: 20px 0; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 8px; box-sizing: border-box; border-radius: 5px; border: 1px solid #ced4da; }
.preview-controls { margin-top: 20px; padding-top: 20px; border-top: 1px solid #dee2e6; display: flex; flex-direction: column; gap: 10px; }
#initialPrompt { padding: 20px; }
#initialPrompt p { font-size: 1.2em; color: #6c757d; text-align: center; margin-top: 50px;}

/* --- PDF PREVIEW STYLES --- */
#pdfPreviewContainer { height: 100%; }
#invoicePreviewWrapper { height: 100%; overflow-y: auto; padding: 20px; box-sizing: border-box; background-color: #e9ecef; }
#invoicePreview { background-color: #fff; width: 794px; min-height: 1123px; margin: 0 auto; box-shadow: 0 0 10px rgba(0,0,0,0.15); box-sizing: border-box; padding: 40px; }

/* --- SETTINGS PAGE STYLES (REVISED) --- */
.settings-layout { display: flex; flex-grow: 1; overflow: hidden; }
.settings-nav { width: 240px; background-color: #fff; border-right: 1px solid black; flex-shrink: 0; display: flex; flex-direction: column; justify-content: space-between; }
.settings-nav-main { padding: 20px 0; }
.settings-nav-button { display: block; width: 100%; text-align: left; background: none; border: none; padding: 12px 20px; font-size: 15px; font-weight: 500; color: #495057; border-radius: 0; border-left: 3px solid transparent; }
.settings-nav-button:hover { background-color: #f1f3f5; }
.settings-nav-button.active { color: #0d6efd; background-color: #e7f1ff; border-left-color: #0d6efd; }
.settings-save-container { padding: 20px; border-top: 1px solid #000000; }
#saveSettingsButton { width: 100%; font-size: 14px; padding: 12px 25px; }
.settings-content { flex-grow: 1; overflow-y: auto; padding: 30px 40px; }
.settings-panel { display: none; }
.settings-panel.active { display: block; animation: fadeIn 0.3s ease-in-out; }
.settings-panel h1 { padding-bottom: 15px; border-bottom: 1px solid #dee2e6; margin-bottom: 30px; font-size: 2em; }
.section { background: #fff; padding: 25px; border-radius: 8px; margin-bottom: 25px; border: 1px solid #dee2e6; }
.section h2 { margin-bottom: 20px; font-size: 1.25em; }
.section p { max-width: 600px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 15px 25px; }
.settings-grid .full-width { grid-column: 1 / -1; }
.charity-item { display: flex; flex-wrap: wrap; gap: 15px; align-items: flex-end; margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px solid #e9ecef; }
.charity-item:last-child { border-bottom: none; }
.charity-item .form-group { flex: 1; margin-bottom: 0; min-width: 150px; }
.remove-charity-button, .remove-zzp-button { height: 40px; background-color: #f8d7da; border-color: #f5c2c7; flex-shrink: 0; }
.remove-charity-button:hover, .remove-zzp-button:hover { background-color: #f1aeb5; }
.zzp-item { border: 1px solid #e9ecef; border-radius: 8px; margin-bottom: 10px; overflow: hidden; transition: box-shadow 0.2s; }
.zzp-item-header { display: flex; justify-content: space-between; align-items: center; padding: 15px; background-color: #f8f9fa; cursor: pointer; }
.zzp-item-header:hover { background-color: #e9ecef; }
.zzp-item-title { font-weight: bold; }
.zzp-item-actions { display: flex; align-items: center; gap: 10px; }
.accordion-toggle { font-family: 'Material Icons Outlined'; font-size: 24px; transition: transform 0.3s ease; }
.zzp-item.collapsed .accordion-toggle { transform: rotate(-90deg); }
.zzp-item-content { max-height: 2000px; padding: 20px; background-color: #fff; transition: max-height 0.5s ease-in-out, padding 0.5s ease-in-out; }
.zzp-item.collapsed .zzp-item-content { max-height: 0; padding-top: 0; padding-bottom: 0; overflow: hidden; }
.zzp-item-details { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; }
.zzp-item-details .full-width { grid-column: 1 / -1; }
.form-group-checkbox { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.form-group-checkbox input { width: auto; flex-shrink: 0; }
.form-group-checkbox label { margin-bottom: 0; font-weight: normal; cursor: pointer; }
.charity-factors-container { margin-top: 15px; padding-top: 15px; border-top: 1px solid #e9ecef; }
.charity-factors-container h4 { margin: 0 0 10px 0; font-size: 1em; color: #212529; }
.charity-factor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.charity-factor-item label { font-weight: normal; color: #6c757d; }
.settings-toast { position: fixed; bottom: 20px; right: 20px; background-color: #212529; color: white; padding: 15px 25px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.2); z-index: 1000; opacity: 0; transform: translateY(20px); transition: opacity 0.3s, transform 0.3s; }
.settings-toast.show { opacity: 1; transform: translateY(0); }
.settings-toast.success { background-color: #198754; }
.settings-toast.error { background-color: #dc3545; }
.email-template-placeholders { font-size: 0.9em; color: #6c757d; margin-top: 5px; background-color: #f8f9fa; padding: 10px; border-radius: 4px; border: 1px solid #e9ecef; }
.email-template-placeholders p { margin: 0 0 5px 0; font-weight: 500; }
.email-template-placeholders code { font-family: monospace; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ======================= ZZP INVOICE WIZARD STYLES ======================= */
.employee-tool-wizard-container { width: 100%; max-width: 1000px; margin: 30px auto; background-color: #fff; border-radius: 12px; border: 1px solid #dee2e6; box-shadow: 0 5px 20px rgba(0,0,0,0.07);height: fit-content; }
.employee-tool-stepper { display: flex; justify-content: space-around; padding: 20px 0; background-color: #f8f9fa; border-bottom: 1px solid #dee2e6; }
.stepper-item { display: flex; flex-direction: column; align-items: center; color: #adb5bd; font-weight: 500; position: relative; flex: 1; }
.stepper-item:not(:last-child)::after { content: ''; position: absolute; top: 18px; left: 50%; width: 100%; height: 2px; background-color: #dee2e6; transform: translateX(18px); z-index: 1; }
.stepper-item-icon { width: 36px; height: 36px; border-radius: 50%; background-color: #dee2e6; display: flex; align-items: center; justify-content: center; font-weight: bold; color: white; margin-bottom: 8px; z-index: 2; transition: background-color 0.3s; }
.stepper-item-text { font-size: 14px; }
.stepper-item.active .stepper-item-icon { background-color: #0d6efd; }
.stepper-item.active .stepper-item-text { color: #0d6efd; }
.stepper-item.completed .stepper-item-icon { background-color: #000000; }
.stepper-item.completed .stepper-item-text { color: #212529; }
.stepper-item.completed:not(:last-child)::after { background-color: #000000; }

.step-panel { display: none; padding: 30px 40px; }
.step-panel.active { display: block; animation: fadeIn 0.4s ease; }
.step-panel h3 { font-size: 1.75em; margin-bottom: 10px; }
.step-panel p { color: #6c757d; max-width: 600px; margin-bottom: 25px; }
.step-navigation { display: flex; justify-content: space-between; padding-top: 20px; margin-top: 20px; border-top: 1px solid #e9ecef; }

/* Step 1 & 2 Styles */
#employeeFileListContainer { min-height: 100px; background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 8px; padding: 10px; margin-bottom: 20px; }
.file-list-item { display: flex; justify-content: space-between; align-items: center; padding: 10px; background-color: #fff; border: 1px solid #e9ecef; border-radius: 5px; margin-bottom: 5px; }
.file-list-item span { font-weight: 500; }
.remove-file-button { background-color: #f8d7da; border: 1px solid #f5c2c7; color: #842029; padding: 5px 10px; border-radius: 5px; cursor: pointer; font-size: 12px; }
#employee-selection-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
#employee-selection-list label { display: flex; align-items: center; gap: 8px; padding: 10px; border: 1px solid #e9ecef; border-radius: 5px; cursor: pointer; transition: background-color 0.2s, border-color 0.2s; }
#employee-selection-list label:hover { background-color: #f8f9fa; }
#employee-selection-list input[type="checkbox"]:checked + span { font-weight: bold; }

/* Step 3: Employee Details Card Styles */
.employee-details-card { border: 1px solid #dee2e6; border-radius: 8px; margin-bottom: 20px; }
.employee-details-header { background-color: #f8f9fa; padding: 15px; border-bottom: 1px solid #dee2e6; font-weight: bold; font-size: 1.1em; }
.employee-details-body { padding: 15px; }
.detail-group { display: flex; gap: 20px; align-items: center; margin-bottom: 15px; }
.detail-group label { font-weight: 500; width: 100px; flex-shrink: 0; }
.extra-costs-container { margin-top: 15px; border-top: 1px solid #e9ecef; padding-top: 15px; }
.extra-cost-item { display: flex; gap: 10px; margin-bottom: 10px; align-items: center; }
.extra-cost-item input { flex-grow: 1; }
.extra-cost-item .remove-cost-button { padding: 5px 10px; font-size: 12px; background-color: #f8d7da; border-color: #f5c2c7; }

/* Step 4: Results Styles */
#employee-results-list { list-style: none; padding: 0; margin-top: 15px; }
#employee-results-list li { display: flex; justify-content: space-between; align-items: center; padding: 15px; background: #f8f9fa; border: 1px solid #e9ecef; border-radius: 5px; margin-bottom: 10px; }
.result-item-info { display: flex; flex-direction: column; }
.result-item-actions { display: flex; gap: 10px; }
#employee-results-list .employee-name { font-weight: bold; }
#employee-results-list .invoice-total { font-family: monospace; font-size: 1.1em; }
#employee-results-list .warning-text { font-size: 0.9em; color: #fd7e14; margin-top: 4px; }

/* --- HISTORY & OTHER (Unchanged) --- */
.settings-history-container { padding: 20px; width: 100%; box-sizing: border-box; }
.settings-history-container h1 { padding-bottom: 15px; border-bottom: 1px solid #dee2e6; margin-bottom: 20px; }
.button-group { display: flex; gap: 10px; margin-top: 20px; }
.filter-controls { display: flex; gap: 10px; padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid #dee2e6; align-items: center; }
.filter-controls span { font-weight: 500; }
.filter-controls button.active { background-color: #0d6efd; border-color: #0d6efd; color: white; }
#unifiedInvoiceList { list-style: none; padding: 0; }
#unifiedInvoiceList li { background: #fff; border: 1px solid #dee2e6; border-radius: 8px; padding: 15px; margin-bottom: 15px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.history-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid #f1f3f5; }
.history-item-header strong { font-size: 1.1em; }
.history-item-header .history-date { font-size: 0.9em; color: #6c757d; }
.history-item-body { padding: 8px 0; color: #495057; }
.history-item-actions { padding-top: 8px; margin-top: 8px; border-top: 1px solid #f1f3f5; display: flex; justify-content: space-between; align-items: center; }
.history-item-actions a { color: #0d6efd; text-decoration: none; font-weight: 500; margin-right: 15px; }
.history-item-actions a:hover { text-decoration: underline; }
.history-item-actions span { color: #6c757d; font-style: italic; }
.invoice-type-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 0.8em; font-weight: 500; margin-right: 10px; border: 1px solid; }
.invoice-type-badge.company { background-color: #cfe2ff; border-color: #9ec5fe; color: #084298; }
.invoice-type-badge.zzp { background-color: #d1e7dd; border-color: #a3cfbb; color: #0f5132; }
.delete-link { color: #dc3545 !important; font-weight: bold; }
.delete-link:hover { color: #a41e2b !important; }

/* PDF-specific styles */
.invoice-pdf-styles { font-family: sans-serif; width: 100%; font-size: 16px; color: #000; }
.invoice-pdf-styles .invoice-title { text-align: left; margin-bottom: 25px; margin-top: 0; line-height: 1.1; font-weight: bold; }
.invoice-pdf-styles .invoice-title .line-1 { font-size: 51px; }
.invoice-pdf-styles .invoice-title .line-2 { font-size: 22px; }
.invoice-pdf-styles table { width: 100%; border-collapse: collapse; margin-bottom: 15px; table-layout: fixed; }
.invoice-pdf-styles td, .invoice-pdf-styles th { padding: 8px; vertical-align: top; border: 1px solid #ccc; word-wrap: break-word; }
.invoice-pdf-styles th { background-color: #eee; font-weight: bold; text-align: left; }
.invoice-pdf-styles .text-right { text-align: right; }
.invoice-pdf-styles .header-table, .invoice-pdf-styles .top-header-table { border: none; margin-bottom: 0; }
.invoice-pdf-styles .header-table td, .invoice-pdf-styles .top-header-table td { border: none; padding: 0; vertical-align: top; }
.invoice-pdf-styles .top-header-table tr { border-bottom: 1px solid #ccc; }
.invoice-pdf-styles .top-header-table td { vertical-align: bottom; padding-bottom: 15px; }
.invoice-pdf-styles .spacer-table { border: none; height: 25px; margin-bottom: 0; }
.invoice-pdf-styles .spacer-table td { border: none; }
.invoice-pdf-styles .recipient-info, .invoice-pdf-styles .sender-info { width: 50%; }
.invoice-pdf-styles .recipient-info { text-align: left; }
.invoice-pdf-styles .company-details { text-align: left; margin-top: 1rem; }
.invoice-pdf-styles .invoice-details { text-align: left; }
.invoice-pdf-styles .detail-label { font-weight: bold; }
.invoice-pdf-styles .compact-table th, .invoice-pdf-styles .compact-table td { padding: 5px 8px; font-size: 14px; }
.invoice-pdf-styles .compact-table th b { font-size: 16px; }
.invoice-pdf-styles .total-table { width: 50%; float: right; border: none; }
.invoice-pdf-styles .total-table td { border: none; }
.invoice-pdf-styles .total-row-label { width: 70%; text-align: right; }
.invoice-pdf-styles .total-row-value { width: 30%; text-align: right; }
.invoice-pdf-styles .total-amount-row { border-top: 1px solid #333; font-size: 16px; font-weight: bold; }
.invoice-pdf-styles .total-amount-row td { padding-top: 8px; }
.invoice-pdf-styles .kwaliteitsborg-charity-list { font-size: 0.9em; font-weight: normal; font-style: italic; }
.invoice-pdf-styles .gib-details { font-size: 10px; margin-left: 5px; font-style: italic; color: #555; }
.invoice-pdf-styles .zzp-financial-details { margin-top: 1rem; }
/* --- NEW CSS FOR AUTOMATION LOG --- */
.cron-log-output {
    background-color: #212529;
    color: #e9ecef;
    font-family: monospace;
    padding: 15px;
    border-radius: 5px;
    margin-top: 15px;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    font-size: 13px;
    display: none; /* Hidden by default */
}