html {
    font-size: 15px;
}

body {
    background-color: #ffd9b4;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

h3 {
    color: #000000;
    font-weight: 600;
    font-size: 1.8rem;
    margin: 0.2rem 0;
}

h4 {
    color: #f98b2b;
    font-weight: 400;
    font-size: 1.2rem;
    margin: 0;
}

small {
    cursor: pointer;
}

#content {
    width: 100%;
    display: flex;
    justify-content: center;
}

.form-error {
    transition: max-height 200ms;
    opacity: 0;
    max-height: 0;
    padding: 0 0.8rem;
    background-color: #ffe0e0;
    border: 1px solid #ffa9a9;
    border-radius: 8px;
    color: #fc6666;
    margin: 0.6rem 0;
    font-size: .8rem;
}

.card-container {
    flex: 1;
    padding: 1.5rem;
    max-width: 30rem;
    background-color: #fafafa;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 12px;
    margin: 2rem;
}

#loginForm {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.input-container {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.5rem;
}

input,
select {
    height: 3rem;
    padding: 0 0.8rem;
    margin-bottom: 0.4rem;
    border-radius: 12px;
    border: 2px solid #ffe3cb;
    background-color: #fafafa;
    transition: all 200ms;
}

select {
    height: 3.2rem;
}

input:focus,
select:focus {
    outline: none;
    border-color: #ff9d2d;
}

input:user-invalid,
select:user-invalid {
    border-color: red;
}

button {
    height: 3.1rem;
    width: 100%;
    font-size: 1.1rem;
    padding-inline: 20px 20px;
    background-color: #f98b2b;
    border-radius: 12px;
    color: white;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background-color 100ms;
}

button:hover {
    background-color: #ec8226;
}

button:disabled {
    background-color: rgba(249, 139, 43, 0.5);
}

.login-submit-button {
    margin-top: 20px
}

label {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
    color: #6E6E6E;
}

.ghost-cell {
    height: 30px;
    width: 100%;
    border-radius: 4px;
    background: #e3e3e3;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

#transactionTableContent {
    border-radius: 12px;
    margin: 1rem;
    background-color: white;
    flex: 1;
    min-height: 100vh;
    padding: 1rem;
}

.user-dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    flex-wrap: wrap;
}

#transaction-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

#transaction-table-head tr th {
    padding: 0.6rem 0.4rem;
    border-bottom: 1px solid #e2e2e2;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
}

#transactionTableBody tr td {
    padding: 1rem 0.4rem;
    border-bottom: 1px solid #e2e2e2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/*Date*/
#transaction-table th:nth-child(1),
#transaction-table td:nth-child(1) {
    width: 7rem;
}

/*Category*/
#transaction-table th:nth-child(3) {
    width: 10rem;
}

/*Amount*/
#transaction-table th:nth-child(4) {
    width: 10rem;
    text-align: right;
}

.table-info-button {
    color: #bbbbbb;
    font-weight: 500;
    font-size: 1.8rem;
    background-color: transparent;
    border: none;
    cursor: pointer;
}

#transactionTableBody tr td:nth-child(4) {
    padding: 0;
}

.amount {
    display: block;
    padding: 1rem 0.4rem;
    white-space: nowrap;
    text-align: right;
}


.amount.positive {
    color: #2b9601;
    background-color: #d4f8c6;
}

.amount.negative {
    color: #dd3535;
    background-color: #ffe0e0;
}

body.modal-open {
    overflow: hidden;
}

#addTransactionButton {
    margin-bottom: 1rem;
}

#addTransactionModal {
    display: none;
    opacity: 0;
}

#addTransactionModal.modal-open {
    display: block;
}



.toast {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background-color: #2b9601;
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0;
    transition: all 300ms;
    z-index: 1000;
}

.refresh-banner {
    text-align: center;
    padding: 0.6rem;
    background-color: #fff3e0;
    border: 1px solid #ffe3cb;
    border-radius: 8px;
    color: #f98b2b;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 300ms;
}

.refresh-banner-visible {
    opacity: 1;
    max-height: 3rem;
}

.toast-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.filter-container div {
    display: flex;
    gap: 0.5rem
}

.modal-backdrop {
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    position: fixed;
    top: 0;
    left: 0;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.filter-container {
    display: flex;
    gap: 0.5rem;
    align-items: end;
    flex-wrap: wrap;
}

#filterButton {
    width: auto;
    height: 3.2rem;
    padding: 0 1rem;
    font-size: 0.9rem;
    margin-bottom: 0.9rem;
}

.clear-filter-button {
    background-color: #e0e0e0;
    color: #333;
    width: auto;
    height: 3.2rem;
    padding: 0 1rem;
    font-size: 0.9rem;
    margin-bottom: 0.9rem;
}

.clear-filter-button:hover {
    background-color: #d0d0d0;
}

.date-range-container {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.date-range-container input {
    flex: 1;
}

#filterInputContainer select {
    width: 100%;
    max-width: 12rem;
}

@media screen and (max-width: 720px) {
    .ghost-cell {
        height: 16px;
    }

    #filterInputContainer select {
        max-width: unset;
    }

    #transaction-table,
    #transaction-table thead,
    #transaction-table tbody,
    #transaction-table tr,
    #transaction-table td {
        display: block;
    }

    #transaction-table thead {
        display: none;
    }

    #transactionTableBody tr {
        background: #fafafa;
        border-radius: 8px;
        padding: 0.8rem;
        margin-bottom: 0.5rem;
        border: 1px solid #e0e0e0;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
    }

    #transactionTableBody tr td {
        border-bottom: none;
        margin-bottom: 0.2rem;
        padding: 0;
    }

    #transactionTableBody tr td::before {
        display: none;
    }

    #transaction-table td:nth-child(1) {
        width: 100%;
        order: 1;
        font-size: 0.75rem;
        color: #999;
    }

    #transaction-table td:nth-child(2) {
        flex: 1;
        order: 2;
        width: 1rem;
        font-size: 1.2rem;
        font-weight: 500;
        min-width: 5rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Amount - right */
    #transaction-table td:nth-child(4) {
        order: 3;
        font-size: 1rem;
        text-align: right;
    }

    /* Category - below merchant, small */
    #transaction-table td:nth-child(3) {
        width: 100%;
        order: 4;
        font-size: 0.8rem;
        color: #999;
    }

    .amount {
        padding: 0;
        text-align: right;
    }

    .amount.positive,
    .amount.negative {
        background-color: transparent;
    }

    .filter-container {
        width: 100%;
    }

    .filter-container>div:nth-child(2) {
        display: flex;
        gap: 1rem;
        width: 100%;
    }

    .filter-container>div:nth-child(2) button {
        flex: 1
    }

    .filter-container>div {
        width: 100%;
        display: block;
    }

    .add-transaction-button-container {
        flex: 1;
    }
}