:root {
    /* General */
    --color-primary: #4f46e5;
    --deep-bg-color: #f0f2f5;
    --text-quiet-color: #999;
    --text-p-color: #555;
    --text-header-color: #333;
    --cancel-red: #e53e3e;

    /* Forms*/
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--deep-bg-color);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a1a2e;
}

.card {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
}

h1 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 1.5rem 0;
}

p {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-p-color);
}

.muted {
    color: var(--text-quiet-color);
    font-style: italic;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ── Forms ── */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.2rem;
}

label {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: #333;
}

.required {
    color: var(--cancel-red);
}

input[type="text"],
input[type="password"] {
    padding: 0.6rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
    background: #fff;
}

input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

input:disabled {
    background: #f5f5f5;
    color: #aaa;
    cursor: not-allowed;
}

.field-error {
    font-size: 0.8rem;
    color: var(--cancel-red);
    margin-top: 0.25rem;
}

/* ── Button ── */
.btn-primary {
    width: 100%;
    padding: 0.7rem;
    background: var(--color-primary);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: background 0.2s;
}

/* EXAM REQUIREMENT: Responsive UI/UX | Cursor hover changes color */
.btn-primary:hover {
    background: var(--color-primary);
}

/* ── Feedback messages ── */
.message {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    text-align: center;
}

.message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.hidden {
    display: none;
}

/*  DASHBOARD LAYOUT */

body.page-dashboard {
    align-items: flex-start;
    padding: 1.5rem;
}

/* ── Shared secondary button (used in nav + form) ── */
.btn-secondary {
    padding: 0.55rem 1.1rem;
    background: #fff;
    color: var(--color-primary);
    font-size: 0.9rem;
    font-weight: 600;
    border: 2px solid var(--color-primary);
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background 0.2s, color 0.2s;
}

/* EXAM REQUIREMENT: Responsive UI/UX | Cursor hover changes color */
.btn-secondary:hover {
    background: var(--color-primary);
    color: #fff;
    text-decoration: none;
}

/* ── Dashboard page wrapper (replaces .card) ── */
.dashboard-page {
    width: 100%;
    max-width: 1200px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}
/*
####################################################################
###                     DASHBOARD DISPLAY                        ###
####################################################################
*/
/* ── Two-column top: A (data viz) left, C (nav) right ── */
.dashboard-top {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

/* ── A1: Data visualization container ── */
.data-viz-container {
    position: relative;
    background: #f8f9fa;
    border-radius: 10px;
    min-height: 280px;
    display: flex;
    align-items: stretch;
}

/* ── A2: Placeholder pill overlay ── 
.data-viz-placeholder {
    background: #ffffff;
    border-radius: 999px;
    padding: 0.6rem 1.8rem;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    color: #1a1a2e;
    pointer-events: none;
    visibility: hidden;
}
*/
/* ── Overall budget box ── */
.data-viz-child {
    flex: 0 0 23%;
    background: #ffffff;
    padding: 0.5rem 0.5rem 0.5rem 0.75rem;
    margin: 0.5rem;
    justify-content: flex-start;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.12);
}

.viz-bold-text {
    font-size: medium;
}

/* ── Sub-category budgets ── */
#sub-budget-container {
    flex: 1;
    margin: 0 0.5rem 0.5rem 0;
    display: flex;
    flex-wrap: wrap;
}
#sub-budget-child {
    flex: 0 0 25%;
    height: 25%;
    margin: 0.5rem 0 0 0.5rem;
    padding: 0.2rem 0 0 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.12);
}
.viz-sub-budget-title {
    font-size: medium;
    text-align: center;
}
.viz-sub-bold-text {
    font-size: small;
    text-align: start;
    margin-left: 0.6rem;
}


/* ── C: Nav actions column ── */
.nav-actions-column {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
}

/* C1: Log out — red pill */
#btn-logout {
    background: var(--cancel-red);
    color: #fff;
    border: 2px solid #b82b2b;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    margin-bottom: 2rem;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    align-self: flex-end;
    transition: background 0.2s, color 0.2s;
}

/* EXAM REQUIREMENT: Responsive UI/UX | Cursor hover changes color */
#btn-logout:hover {
    background: #af2d2d;
    color: #fff;
}

/* C2/C3: Nav links */
#link-categories,
#link-reports {
    border-radius: 8px;
    text-align: center;
    font-size: 0.85rem;
}

/* ── B: Add Transaction section ── */
.add-transaction-section {
    border-top: 1px solid #e0e0e0;
    padding-top: 1rem;
}

.add-transaction-section h2 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    color: #1a1a2e;
}

/* Single horizontal flex row for all B fields */
.txn-form-row {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 0.6rem;
    flex-wrap: nowrap;
}

/* Override vertical form-group stacking inside the row */
.txn-form-row .form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

/* Field width modifiers */
.txn-amount-group  { width: 110px; flex-shrink: 0; }
.txn-budget-group  { width: 150px; flex-shrink: 0; }
.txn-desc-group    { flex: 1 1 0; min-width: 120px; }
.txn-date-group    { flex-shrink: 0; }

/* Date sub-row: [TODAY] OR [date input] */
.txn-form-row .date-input-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.4rem;
}

.txn-date-group > label { 
    margin-bottom: 0.3rem
}

#btn-today {
    height: 33px;
    display: flex;
    align-items: center;
    justify-content: center;

}
.or-text {
    font-size: 0.8rem;
    font-weight: 600;
    color: #888;
    white-space: nowrap;
}

/* B1: Red cancel (x) square */
#btn-cancel-txn {
    width: 30px;
    height: 30px;
    background: var(--cancel-red);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-bottom: 0.3rem;
    align-self: flex-end;
}
#btn-cancel-txn:hover { background: #c53030; }

/* B8: Green pill DONE button */
#btn-save-txn {
    background: #22c55e;
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 0.5rem 1.4rem;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    width: auto;
    margin-top: 0;
    margin-bottom: 0.4rem;
    align-self: flex-end;
    transition: background 0.2s;
}

/* EXAM REQUIREMENT: Responsive UI/UX | Cursor hover changes color, and clearly indicates when a button is disabled */
#btn-save-txn:hover:not(:disabled) { background: #16a34a; }
#btn-save-txn:disabled {
    background: #86efac;
    cursor: not-allowed;
}

/* Input sizing scoped to the horizontal row */
.txn-form-row input[type="number"],
.txn-form-row input[type="text"],
.txn-form-row input[type="date"],
.txn-form-row select {
    padding: 0.45rem 0.6rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.9rem;
    background: #fff;
    width: 100%;
}
.txn-form-row input[type="number"]:focus,
.txn-form-row input[type="text"]:focus,
.txn-form-row input[type="date"]:focus,
.txn-form-row select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.txn-form-row label {
    font-size: 0.75rem;
}

#transaction-message {
    margin-bottom: 0.5rem;
}

/* 
####################################################################
###                      CATEGORIES PAGE                         ###
####################################################################
*/

/* ── Page header ── */
.cat-page-header {
    margin-bottom: 1.25rem;
}

.cat-page-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

/* ── Surplus bar ── */
.surplus-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    margin-bottom: 0.75rem;
}

.surplus-bar.surplus-bar-warning {
    background: #fff7ed;
    border-color: #fdba74;
}

.surplus-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #166534;
}

.surplus-bar-warning .surplus-label {
    color: #9a3412;
}

.surplus-value {
    font-size: 1rem;
    font-weight: 700;
    color: #166534;
}

.surplus-bar-warning .surplus-value {
    color: #9a3412;
}

/* ── Add panel ── */
.cat-add-panel {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.cat-add-row {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.cat-add-name  { flex: 1 1 160px; margin-bottom: 0; }
.cat-add-amount { width: 140px; flex-shrink: 0; margin-bottom: 0; }

.cat-add-actions {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    padding-bottom: 1px;
}

.cat-add-save {
    width: auto;
    padding: 0.55rem 1.2rem;
    font-size: 0.9rem;
    margin-top: 0;
}

.cat-add-cancel {
    font-size: 0.9rem;
}

.cat-add-hint {
    font-size: 0.8rem;
    margin-top: 0.5rem;
    text-align: left;
}

.cat-hint-ok   { color: #166534; }
.cat-hint-warn { color: #9a3412; }

/* ── Table wrapper ── */
.cat-table-wrapper {
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.cat-table-header {
    display: flex;
    align-items: center;
    padding: 0.6rem 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.78rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Column widths — shared by header and rows ── */
.cat-col-name    { flex: 1; }
.cat-col-amount  { width: 120px; text-align: right; }
.cat-col-actions { width: 140px; text-align: right; }

.cat-btn-add {
    width: auto;
    padding: 0.4rem 0.9rem;
    font-size: 0.8rem;
    margin-top: 0;
}

/* ── Rows ── */
.cat-loading {
    padding: 1.5rem;
    text-align: center;
    color: #999;
    font-size: 0.9rem;
}

.cat-row {
    border-bottom: 1px solid #e0e0e0;
}

.cat-row:last-child {
    border-bottom: none;
}

.cat-row-pinned .cat-row-main {
    background: #f8f9fa;
}

.cat-row-main {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.15s;
}

.cat-row-main:hover {
    background: #f0f2f5;
}

.cat-row-open .cat-row-main {
    background: #eef2ff;
}

.cat-row-main .cat-col-name {
    font-size: 0.95rem;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cat-row-main .cat-col-amount {
    font-size: 0.9rem;
    font-family: monospace;
    color: #1a1a2e;
}

.cat-badge-locked {
    font-size: 0.72rem;
    background: #e0e0e0;
    color: #555;
    border-radius: 999px;
    padding: 2px 8px;
    font-weight: 600;
}

.cat-cannot-delete {
    font-size: 0.75rem;
    color: #aaa;
}

.cat-quick-delete {
    background: none;
    border: none;
    color: #e53e3e;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 4px 6px;
    opacity: 0.6;
    border-radius: 4px;
    transition: opacity 0.15s, background 0.15s;
}

.cat-quick-delete:hover {
    opacity: 1;
    background: #fee2e2;
}

/* ── Edit panel ── */
.cat-edit-panel {
    padding: 0.75rem 1rem 0.85rem;
    background: #f8f9fa;
    border-top: 1px solid #e8e8e8;
}

.cat-edit-message {
    margin-bottom: 0.6rem;
}

.cat-edit-row {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.cat-edit-name-group,
.cat-edit-amount-group {
    margin-bottom: 0;
}

.cat-edit-name-group   { width: 150px; flex-shrink: 0; }
.cat-edit-amount-group { width: 120px; flex-shrink: 0; }

.cat-edit-name-group label,
.cat-edit-amount-group label {
    font-size: 0.75rem;
}

.cat-edit-name-group input,
.cat-edit-amount-group input {
    padding: 0.45rem 0.6rem;
    font-size: 0.9rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    width: 100%;
    background: #fff;
}

.cat-edit-name-group input:focus,
.cat-edit-amount-group input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.cat-edit-divider {
    width: 1px;
    height: 28px;
    background: #ddd;
    flex-shrink: 0;
    align-self: flex-end;
    margin-bottom: 4px;
}

.cat-edit-save-btn,
.cat-edit-maximize-btn,
.cat-edit-clear-btn {
    font-size: 0.8rem;
    padding: 0.45rem 0.85rem;
    align-self: flex-end;
}

.cat-edit-save-btn:disabled,
.cat-edit-maximize-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.cat-btn-danger {
    color: #e53e3e;
    border-color: #e53e3e;
}

.cat-btn-danger:hover {
    background: #e53e3e;
    color: #fff;
}

.cat-edit-delete-btn {
    font-size: 0.8rem;
    padding: 0.45rem 0.85rem;
    align-self: flex-end;
}
/*
####################################################################
###                           REPORTS                            ###
####################################################################
*/
.filter-container { position: relative; }

.filter-drop-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.5rem;
    z-index: 10;
    min-width: 160px;
    flex-direction: column;
    gap: 0.4rem;
}

.cat-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
}