@import url('https://fonts.googleapis.com/css2?family=Sora:wght@100..800&display=swap');

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap');

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

:root {
    --bg: #f5f0e8;
    --surface: #fffdf7;
    --surface2: #f0ebe0;
    --border: #e0d8c8;
    --text: #1a1510;
    --text2: #6b5e4e;
    --accent: #d4400a;
    --accent2: #f07d3a;
    --green: #2d7a4f;
    --red: #c0392b;
    --shadow: rgba(26, 21, 16, 0.08);
    --shadow2: rgba(26, 21, 16, 0.15);
}

[data-theme="dark"] {
    --bg: #0f0d0a;
    --surface: #1a1612;
    --surface2: #252018;
    --border: #2e2820;
    --text: #f0e8d8;
    --text2: #9a8878;
    --accent: #f07d3a;
    --accent2: #d4400a;
    --green: #4caf7d;
    --red: #e05555;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow2: rgba(0, 0, 0, 0.5);
}


body {
    font-family: "Sora", sans-serif;
    background-color: var(--bg);
    color: var(--text);
    transition: background 0.3s, color 0.3s;
}

/*  font-family: "JetBrains Mono", monospace; */

a {
    text-decoration: none;
}

ul li {
    list-style-type: none;
}


.container {
    max-width: 1170px;
    padding: 0 15px;
    margin: 0 auto;
    width: 100%;
}


/* header */

header .header-container {
    max-width: 1230px;
    padding: 0 15px;
    margin: 0 auto;
    width: 100%;
}

header {
    background: var(--surface);
    border-bottom: 2px solid var(--border);
    top: 0;
    z-index: 100;
    box-shadow: 0px 2px 12px var(--shadow);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background-color: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    color: #fff;
    font-weight: 800;
}

.logo span {
    color: var(--accent);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.currency-select {
    font-size: 13px;
    font-family: "Noto Color Emoji", "Segoe UI Emoji", sans-serif;
    font-weight: 600;
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 0.38rem 0.75rem;
    color: var(--text);
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.currency-select:focus {
    border-color: var(--accent);
}


.btn-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--surface2);
    color: var(--text2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}


.btn-icon:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--bg);
}

.summary-grid {
    display: flex;
    gap: 20px;
    padding-top: 45px;
    padding-bottom: 30px;
}


.summary-card {
    background-color: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 33.33%;
    padding: 25px;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0px 8px var(--shadow2);
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.summary-card::before {
    background-color: var(--accent);
}

.card-income::before {
    background: var(--green);
}

.card-expense::before {
    background: var(--red);
}

.card-label {
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text2);
    margin-bottom: 10px;
}


.card-amount {
    font-family: "JetBrains Mono", monospace;
    font-size: 28px;
    font-weight: 500;
    letter-spacing: -1px;
    line-height: 1;
}


.card-balance .card-amount {
    color: var(--accent);
}

.card-income .card-amount {
    color: var(--green);
}

.card-expense .card-amount {
    color: var(--red);
}

.card-sub {
    font-size: 12px;
    color: var(--text2);
    margin-top: 10px;
}


.form-section {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 30px;
}

.form-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text2);
    margin-bottom: 16px;
}

.form-grid {
    display: flex;
    align-items: flex-end;
    gap: 46px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}


.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}


.form-input,
.form-select {
    background: var(--bg);
    font-size: 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 10px 16px;
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-input:focus,
.form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(212, 64, 10, 0.1);
}

.form-select {
    cursor: pointer;
}


.btn-add {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 19px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    white-space: nowrap;
}

.btn-add:hover {
    background: var(--accent2);
    transform: translateY(-1px);
}

.btn-add:active {
    transform: translateY(0);
}


.type-toggle {
    display: flex;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    height: 38px;
}


.type-btn {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text2);
    padding: 10px 12px;
    transition: all 0.2s;
}


.type-btn.active-income {
    background-color: var(--green);
    color: #fff;
}


.type-btn.active-expense {
    background-color: var(--red);
    color: #fff;
}


/* toolbar */

.toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.search-wrap {
    flex: 1;
    position: relative;
    min-width: 200px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text2);
    font-size: 0.9em;
    pointer-events: none;
}

.search-input {
    width: 100%;
    font-size: 14px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 11px 10px 11px 50px;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--accent);
}

.search-input::placeholder {
    color: var(--text2);
}


.filter-select {
    font-size: 13px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 11px;
    color: var(--text2);
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.filter-select:focus {
    border-color: var(--accent);
}

.btn-csv {
    background: var(--surface);
    color: var(--green);
    border: 1.5px solid var(--green);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.btn-csv:hover {
    background: var(--green);
    color: #fff;
}

/* Table section */
.table-section {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}


.table-header {
    padding: 16px 24px;
    border-bottom: 1.5px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-title {
    font-size: 13.6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text2);
}


.entry-count {
    font-size: 12.48px;
    color: var(--text2);
    background: var(--surface2);
    padding: 3px 8px;
    font-family: "JetBrains Mono", monospace;
    border-radius: 6px;
    border: 1px solid var(--border);
}


table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: left;
    font-size: 11.2px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text2);
    padding: 12px 24px;
    background: var(--surface2);
    border-bottom: 1.5px solid var(--border);
}

thead th:last-child {
    text-align: right;
}


tbody tr {
    border: 1px solid var(--border);
    transition: background 0.15s;
    animation: rowIn 0.3s ease both;
}


@keyframes rowIn {

    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--surface2);
}

tbody td {
    padding: 13.6px 24px;
    font-size: 0.875rem;
}

.desc-cell {
    font-weight: 500;
    color: var(--text);
}

.cat-badge {
    display: inline-block;
    font-size: 10.88px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.date-cell {
    font-family: "JetBrains Mono", monospace;
    font-size: 12.48px;
    color: var(--text2);
}


.amount-cell {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.92rem;
    font-weight: 500;
    text-align: right;
}


.amount-income {
    color: var(--green);
}

.amount-expense {
    color: var(--red);
}


.actions-cell {
    text-align: right;
}

.btn-delete {
    background: none;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    color: var(--text2);
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-delete:hover {
    border-color: var(--red);
    color: var(--red);
    background-color: rgba(192, 57, 43, 0.05);
}

/* chart section */
.chart-section {
    background: var(--surface);
    /* BUG FIX: "var (--border)" এ space ছিল, CSS variable কাজ করছিল না → fixed to var(--border) */
    border: 1.5px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 32px;
}


.chart-header {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text2);
    margin-bottom: 20px;
}

.wrapper-main {
    display: flex;
    align-items: center;
    gap: 40px;
}


.chart-wrap {
    position: relative;
    width: 220px;
    height: 220px;
    flex-shrink: 0;
}


.breakdown-col {
    flex: 1;
    min-width: 0;
}


.chart-legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.82rem;
}


.legend-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-name {
    color: var(--text);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.legend-pct {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.78rem;
    color: var(--text2);
    flex-shrink: 0;
}


.legend-bar-wrap {
    width: 80px;
    height: 4px;
    background: var(--surface2);
    /* BUG FIX: "border-width: 99px" ছিল যা ভুল property → fixed to border-radius: 99px */
    border-radius: 99px;
    overflow: hidden;
    flex-shrink: 0;
}


.legend-bar {
    height: 100%;
    border-radius: 99px;
    transition: width 0.5s ease;
}


.chart-empty {
    text-align: center;
    color: var(--text2);
    font-size: 13.6px;
    padding: 48px 16px;
}


.empty-state {
    text-align: center;
    padding: 64px 32px;
    color: var(--text2);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-text {
    font-size: 14.08px;
}

/* footer */

.page-footer {
    text-align: center;
    padding: 27px 32px;
    font-size: 12px;
    color: var(--text2);
    border-top: 1px solid var(--border);
    margin-top: 32px;
}

.page-footer span {
    color: var(--accent);
    font-weight: 600;
}


.currency-selectt {
    font-family: "Noto Color Emoji", "Segoe UI Emoji", sans-serif;
}



/* Toast */

.toast {
    position: fixed;
    bottom: 32px;
    right: 32px;
    background-color: var(--text);
    color: var(--bg);
    padding: 12px 20px;
    border-radius: 14px;
    font-size: 13.6px;
    font-weight: 500;
    z-index: 9999;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Edit button */


.btn-edit {
    background: none;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    color: var(--text2);
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.2s;
    margin-right: 6px;
}

.btn-edit:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(212, 64, 10, 0.05);
}


/* Edit modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}


.modal-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.modal-box {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 20px;
    padding: 28px;
    width: 100%;
    max-width: 480px;
    margin: 16px;
    transform: translateY(20px);
    transition: transform 0.25s;
    box-shadow: 0px 20px 60px var(--shadow2);
}

/* BUG FIX: modal-box এ "var(--bordrer)" typo ছিল → fixed to var(--border) */

.modal-overlay.show .modal-box {
    transform: translateY(0);
}

.modal-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text2);
    margin-bottom: 20px;
}

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

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}


.btn-cancel {
    background-color: var(--surface2);
    color: var(--text2);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel:hover {
    border-color: var(--text2);
    color: var(--text);
}

.btn-save {
    background-color: var(--accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}


.btn-save:hover {
    background: var(--accent2);
    transform: translateY(-1px);
}


/* Custom scrollbar */
html::-webkit-scrollbar-track {
    -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    background-color: var(--surface2);
}

html::-webkit-scrollbar {
    width: 8px;
    background-color: var(--surface2);
}

html::-webkit-scrollbar-thumb {
    border-radius: 10px;
    -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
    background-color: var(--accent);
}


/* Scroll to top button */
.btn-scroll-top {
    position: fixed;
    bottom: 40px;
    left: 40px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text2);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px var(--shadow2);
    opacity: 0;
    transform: translateY(16px);
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s, border-color 0.2s, color 0.2s, background 0.2s;
    z-index: 999;
}

.btn-scroll-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.btn-scroll-top:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--bg);
}


@media screen and (max-width:1199px) {
    .summary-grid {
        flex-wrap: wrap;
    }

    .summary-card {
        width: 100%;
    }

    .form-grid {
        flex-wrap: wrap;
        gap: 30px;
    }

    .form-group {
        width: 47%;
    }

    .last-group {
        width: 30%;
        display: flex;
        margin: auto;
    }

    .toolbar {
        gap: 20px;
        justify-content: center;
        margin-bottom: 30px;
    }

    .page-footer {
        padding: 20px;
    }
}

@media screen and (max-width:1025px) {
    .modal-form .form-group {
        width: 100% !important;
    }
}


@media screen and (max-width:768px) {
    .form-group {
        width: 100%;
    }

    .last-group {
        width: 40%;
    }

    .page-footer {
        padding: 18px;
    }
}


@media screen and (max-width:575px) {
    .form-grid {
        gap: 25px;
    }

    .toolbar {
        gap: 15px;
        justify-content: center;
    }

    .table-section {
        overflow-x: auto;
        width: 100%;
    }

    .table-section::-webkit-scrollbar {
        display: none;
    }

    .empty-sate {
        width: 100%;
        min-width: 527px;
        color: var(--text2);
    }

    /* pore */
    .table-header {
        min-width: 574px;
    }

    .logo {
        font-size: 20px;
        gap: 6px;
    }

    .logo-icon {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }

    .header-actions {
        gap: 10px;
    }

    .btn-icon {
        width: 32px;
        height: 32px;
    }

    .card-amount {
        font-size: 25px;
    }

    .card-label {
        font-size: 13px;
    }

    .summary-card {
        padding: 20px;
    }

    .card-label {
        margin-bottom: 8px;
    }

    .card-sub {
        margin-top: 8px;
    }

    .card-amount {
        font-size: 23px;
    }

    .summary-grid {
        padding-top: 32px;
    }

    thead th {
        padding: 12px 27px;
    }

    .wrapper-main {
        flex-direction: column;
        align-items: center;
        gap: 25px;
    }

    .chart-wrap {
        width: 180px;
        height: 180px;
    }

    .last-group {
        width: 48%;
    }

    .summary-grid {
        gap: 15px;
    }

    .wrapper-main {
        gap: 20px;
    }

    .page-footer p {
        line-height: 18px;
    }

    .btn-edit {
        margin-bottom: 5px;
        margin-right: 0;
    }

    .chart-section {
        margin-bottom: 30px;
    }

    .btn-scroll-top {
        position: fixed;
        bottom: 53px;
        left: 32px;
        width: 35px;
        height: 35px;
    }

}


@media screen and (max-width:480px) {
    .btn-scroll-top {
        bottom: 37px;
    }
}


@media screen and (max-width:375px) {
    .btn-scroll-top {
        bottom: 55px;
    }
}