/* ── reset & base ── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #0e0a1a;
    color: #e0d4f8;
    min-height: 100vh;
}

/* ── header ── */
header {
    background-color: #50207A;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    color: #D6B9FC;
    font-size: 22px;
}

header button {
    background-color: #838CE5;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

header button:hover {
    background-color: #6e76d0;
}

/* ── main ── */
main {
    max-width: 1100px;
    margin: 24px auto;
    padding: 0 20px;
}

/* ── summary cards ── */
.summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.card {
    background-color: #1a1030;
    border-radius: 8px;
    padding: 20px 24px;
    border-left: 4px solid #50207A;
}

#cardIncome  { border-left-color: #838CE5; }
#cardExpense { border-left-color: #D6B9FC; }
#cardBalance { border-left-color: #50207A; }

.card p {
    font-size: 12px;
    color: #9880b8;
    margin-bottom: 6px;
}

.card h3 {
    font-size: 20px;
    color: #f0eaff;
}

/* ── chart container ── */
/* moved this up here so it matches the html order */
.chart-container {
    background-color: #1a1030;
    border-radius: 8px;
    padding: 20px;
    border-left: 4px solid #D6B9FC;
    max-width: 400px;
    margin: 0 auto 24px auto; /* centers it and adds bottom space */
}

/* ── filters ── */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
    align-items: flex-end;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-item label {
    font-size: 11px;
    color: #9880b8;
}

.filter-item select,
.filter-item input[type="date"] {
    padding: 7px 10px;
    background-color: #1a1030;
    border: 1px solid #50207A;
    border-radius: 6px;
    color: #D6B9FC;
    font-size: 13px;
    height: 36px;
    width: 160px;
}

#clearFiltersBtn {
    height: 36px;
    width: 80px;
    padding: 7px 14px;
    background-color: #1a1030;
    border: 1px solid #50207A;
    border-radius: 6px;
    color: #D6B9FC;
    cursor: pointer;
    font-size: 13px;
}

#clearFiltersBtn:hover {
    background-color: #2a1a45;
}

/* ── table section ── */
.table-section h2 {
    font-size: 16px;
    color: #D6B9FC;
    margin-bottom: 12px;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: #1a1030;
    border-radius: 8px;
    overflow: hidden;
    font-size: 13px;
    min-width: 600px;
}

thead {
    background-color: #50207A;
}

th {
    padding: 10px 14px;
    text-align: left;
    color: #D6B9FC;
    font-weight: 500;
}

td {
    padding: 10px 14px;
    border-top: 1px solid #2a1a45;
    color: #e0d4f8;
}

.income-amt {
    color: #838CE5;
    font-weight: 500;
}

.expense-amt {
    color: #D6B9FC;
    font-weight: 500;
}

/* action buttons inside table */
.edit-btn {
    background-color: #2a1a45;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    color: #838CE5;
    cursor: pointer;
    font-size: 12px;
    margin-right: 4px;
}

.delete-btn {
    background-color: #2a1030;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    color: #D6B9FC;
    cursor: pointer;
    font-size: 12px;
}

.edit-btn:hover   { background-color: #3a2a55; }
.delete-btn:hover { background-color: #3a1535; }

/* empty state message */
#emptyState {
    text-align: center;
    padding: 24px;
    color: #9880b8;
    font-size: 14px;
    display: none;
}

/* ── modal overlay ── */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 5, 25, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.hidden {
    display: none;
}

/* ── modal box ── */
.modal {
    background-color: #1a1030;
    border: 1px solid #50207A;
    border-radius: 10px;
    padding: 24px;
    width: 380px;
    max-width: 95%;
}

.small-modal {
    width: 300px;
}

.modal-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-top h2 {
    font-size: 16px;
    color: #D6B9FC;
}

.modal-top button {
    background: none;
    border: none;
    color: #9880b8;
    font-size: 18px;
    cursor: pointer;
}

.modal-top button:hover {
    color: #D6B9FC;
}

/* ── form ── */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 12px;
    color: #9880b8;
    margin-bottom: 5px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 10px;
    background-color: #0e0a1a;
    border: 1px solid #50207A;
    border-radius: 6px;
    color: #e0d4f8;
    font-size: 13px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #838CE5;
}

.input-error {
    border-color: #e05a5a !important;
}

.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 4px;
}

.radio-group label {
    font-size: 13px;
    color: #e0d4f8;
    display: flex;
    align-items: center;
    gap: 6px;
}

.err {
    font-size: 11px;
    color: #e05a5a;
    margin-top: 4px;
    display: block;
}

/* ── form buttons ── */
.form-btns {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.form-btns button {
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

#cancelFormBtn,
#cancelDeleteBtn {
    background-color: transparent;
    border: 1px solid #50207A;
    color: #D6B9FC;
}

#cancelFormBtn:hover,
#cancelDeleteBtn:hover {
    background-color: #2a1a45;
}

#submitFormBtn {
    background-color: #838CE5;
    border: none;
    color: #fff;
}

#submitFormBtn:hover {
    background-color: #6e76d0;
}

#confirmDeleteBtn {
    background-color: #7a1a1a;
    border: none;
    color: #f8d4d4;
}

#confirmDeleteBtn:hover {
    background-color: #9a2020;
}

.small-modal h2 {
    font-size: 15px;
    color: #D6B9FC;
    margin-bottom: 8px;
}

.small-modal p {
    font-size: 13px;
    color: #9880b8;
}

/* ── toast notification ── */
#toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #838CE5; /* matches accent color */
    color: #fff;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    transition: opacity 0.3s ease, bottom 0.3s ease;
}

#toast.hidden {
    opacity: 0;
    bottom: 10px;
    pointer-events: none;
    display: block; /* overrides the default display: none from .hidden */
    visibility: hidden;
}

#toast.show {
    opacity: 1;
    bottom: 30px;
    visibility: visible;
}

/* ── responsive ── */
@media (max-width: 768px) {
    /* Stack header vertically on mobile */
    header { 
        flex-direction: column; 
        gap: 12px; 
    }
    
    /* Make buttons sit side-by-side evenly */
    header div {
        display: flex;
        width: 100%;
        gap: 10px;
    }
    
    header h1 { font-size: 20px; }
    
    header button { 
        flex: 1; /* makes buttons equal width */
        font-size: 12px; 
        padding: 8px; 
        margin-right: 0 !important; /* overrides the inline style */
    }

    main { padding: 0 12px; }

    .summary {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .card { padding: 14px 16px; }

    .filter-item {
        flex: 1 1 calc(50% - 12px);
    }

    .filter-item select,
    .filter-item input[type="date"] {
        width: 100%;
    }

    #clearFiltersBtn { width: 100%; }
}
