/* === BASE & LAYOUT STYLES === */
html, body {
    margin: 0; padding: 0; height: 100%; overflow: hidden;
    background-color: #525659;
    font-family: 'Times New Roman', serif;
}
#app-container { display: flex; flex-direction: column; height: 100vh; }
#top-bar {
    flex-shrink: 0; background: #f8f9fa; padding: 8px 15px; border-bottom: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); z-index: 1002; display: flex; flex-wrap: wrap; align-items: center; gap: 15px;
}
#top-bar .button-group { display: flex; align-items: center; gap: 8px; }
#top-bar button {
    background: #1a4d72; color: white; border: none; padding: 6px 12px; border-radius: 4px;
    cursor: pointer; font-size: 13px; font-family: Arial, sans-serif; transition: background-color 0.2s; white-space: nowrap;
}
#top-bar button:hover { background: #0f3a5f; }
#top-bar button:disabled { background: #c0c0c0; cursor: not-allowed; }
#top-bar .pdf-btn { background-color: #28a745; }
#top-bar .copy-btn { background-color: #007bff; }
#top-bar .new-btn { background-color: #6c757d; }
#top-bar .settings-btn { background-color: #ffc107; color: #212529; }
#zoom-controls button { padding: 4px 8px; font-size: 16px; width: 32px; }
#page-nav-controls { color: #333; font-family: Arial, sans-serif; font-size: 14px; }

#zoom-container { flex-grow: 1; overflow: auto; padding: 20px; text-align: center; }
#statement-pages-wrapper {
    display: inline-flex; flex-direction: column; gap: 20px;
    margin: 0 auto; transform-origin: top center; transition: transform 0.15s ease-out;
}

/* === PAGE & BANK STATEMENT STYLES === */
.page {
    width: 210mm; height: 297mm;
    margin: 0 auto; background: white;
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
    padding: 10mm;
    display: flex;
    flex-direction: column;
}
.page-header { text-align: center; flex-shrink: 0; margin-bottom: 15px; }
.page-header .editable { text-align: center; display: inline-block; }
.bank-name { font-size: 20px; font-weight: bold; margin-bottom: 3px; }
.branch-info { font-size: 13px; margin-bottom: 3px; }
.statement-title { font-size: 16px; font-weight: bold; margin-top: 8px; border-bottom: 1px solid #000; padding-bottom: 2px; display: inline-block; }

/* --- Customer Info --- */
.customer-info { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 15px; font-size: 12px; flex-shrink: 0; }
.info-group { display: flex; flex-direction: column; gap: 2px; }
.info-row { display: grid; align-items: flex-start; } 
.left-column .info-row { grid-template-columns: 80px 10px 1fr; } 
.right-column .info-row { grid-template-columns: 150px 10px 1fr; }
.label { text-align: right; }
.colon { text-align: center; font-weight: bold; }
.info-row .editable { text-align: left; }

/* --- Content and Table Styles --- */
.page-content { flex-grow: 1; overflow: hidden; } 
.transaction-table { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
.transaction-table th, .transaction-table td { border: 1px solid #d8d8d8; padding: 3px 4px; text-align: left; vertical-align: top; }
.transaction-table th { background-color: #f0f0f0; font-weight: bold; text-align: center; }
.transaction-table .amount { text-align: right; }
.transaction-table .center { text-align: center; }
.transaction-table .particulars { min-height: 1.2em; }

/* --- STICKY TOTALS FOOTER --- */
.totals-summary-container {
    display: flex; justify-content: flex-end; padding-top: 10px;
    margin-top: auto; border-top: 2px solid #000; flex-shrink: 0;
}
.totals-summary { width: 400px; flex-shrink: 0; }
.total-row {
    display: flex; justify-content: space-between; padding: 4px 8px;
    font-size: 13px; font-weight: bold; border-bottom: 1px solid #eee;
}
.total-row:last-of-type { background-color: #f0f0f0; border-bottom: none; }
.total-row .label { font-weight: normal; }

/* --- Final Page Footer --- */
.page-footer { padding-top: 10px; font-size: 10px; text-align: center; flex-shrink: 0; }
.page-number-display { font-weight: bold; margin-top: 10px; }
.footer-text {
    font-size: 13px;
    font-family: Arial, sans-serif;
    color: #333;
    line-height: 1.5;
}

/* --- UTILITY STYLES --- */
.editable {
    outline: none; border: none; background: transparent; font-family: inherit;
    font-size: inherit; padding: 1px 2px; word-wrap: break-word; min-height: 1em; width: 100%;
}
.editable:focus { outline: 1px dashed #007bff; background: #e7f1ff; }

#notification-bar {
    position: fixed; top: 60px; left: 50%; transform: translateX(-50%); color: white;
    padding: 10px 20px; border-radius: 5px; z-index: 1003; opacity: 0;
    transition: opacity 0.3s ease; pointer-events: none; font-weight: 500;
}
#notification-bar.show { opacity: 1; }

/* --- Settings Modal --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); z-index: 1010;
    display: flex; align-items: center; justify-content: center;
}
.modal-content {
    background: white; border-radius: 8px; width: 400px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    font-family: Arial, sans-serif;
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 20px; border-bottom: 1px solid #dee2e6;
}
.modal-header h2 { margin: 0; font-size: 18px; }
.close-btn {
    border: none; background: transparent; font-size: 24px;
    cursor: pointer; padding: 0 8px; color: #6c757d;
}
.modal-body { padding: 20px; }
.setting-row {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 15px;
}
.setting-row label { font-size: 14px; }
.setting-row input {
    width: 80px; padding: 6px 8px; font-size: 14px;
    border: 1px solid #ced4da; border-radius: 4px;
}
.modal-footer {
    padding: 12px 20px; border-top: 1px solid #dee2e6;
    text-align: right;
}
#settings-save-btn {
    background: #007bff; color: white; border: none; padding: 8px 16px;
    border-radius: 4px; cursor: pointer; font-size: 14px;
}
#settings-save-btn:hover { background: #0056b3; }


/* --- PRINT STYLES --- */
@media print {
    body { background-color: white; }
    #top-bar, #zoom-container { display: none; }
    .page {
        width: 100%; height: auto; margin: 0; box-shadow: none; border: none;
        padding: 10mm; page-break-after: always;
    }
    #statement-pages-wrapper { display: block; }
}