/* ============================================
   IMPORT
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

body {
    font-family: 'Inter', sans-serif;
    background-color: #09090b;
    color: #ffffff;
    min-height: 100vh;
}

/* ============================================
   HEADER
   ============================================ */
header {
    background-color: #121214;
    padding: 18px 40px;
    border-bottom: 1px solid #202024;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 32px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.3px;
}

#total-balance {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

#total-label {
    font-size: 13px;
    font-weight: 500;
    color: #888888;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#total-amount {
    font-size: 26px;
    font-weight: 700;
    color: #ffffff;
}

#logout-link {
    font-size: 15px;
    font-weight: 500;
    color: #888888;
    text-decoration: none;
    transition: color 0.2s;
}

#logout-link:hover {
    color: #ef4444;
}

/* ============================================
   MAIN LAYOUT
   ============================================ */
main {
    max-width: 1100px;
    margin: 28px auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ============================================
   SECTIONS
   ============================================ */
section {
    background: #121214;
    border-radius: 14px;
    padding: 28px;
    border: 1px solid #202024;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

section h2 {
    font-size: 16px;
    font-weight: 600;
    color: #71717a;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 24px;
}

.transactions {
    grid-column: 1 / -1;
    overflow-x: auto;
}

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

.section-header h2 {
    margin-bottom: 0;
}

#view-all-link {
    font-size: 13px;
    font-weight: 500;
    color: #a1a1aa;
    text-decoration: none;
    transition: color 0.2s;
}

#view-all-link:hover {
    color: #ffffff;;
}

/* ============================================
   ACCOUNTS
   ============================================ */
.account-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.card {
    background: #18181b;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid #27272a;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    border-color: #f4f4f5;
    transform: translateY(-2px);
}

.account-name {
    font-size: 18px;
    font-weight: 600;
    color: #f4f4f5;
}

.account-type {
    font-size: 14px;
    color: #a1a1aa;
    text-transform: capitalize;
}

.account-balance {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    margin-top: 8px;
    letter-spacing: -0.5px;
}

.card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.edit-toggle {
    background: none;
    border: none;
    color: #888888;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    font-family: 'Inter', sans-serif;
    transition: color 0.2s;
}

.edit-toggle:hover {
    color: #ffffff;
}

.card-actions form button {
    background: none;
    border: none;
    color: #888888;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    font-family: 'Inter', sans-serif;
    transition: color 0.2s;
}

.card-actions form button:hover {
    color: #ef4444;
    background: none;
}

.edit-form {
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.edit-form button[type="submit"] {
    background-color: #ffffff;
    border-color: #ffffff;
    color: #000000;
    padding: 8px;
    font-size: 13px;
}

.edit-form button[type="submit"]:hover {
    background-color: #e5e5e5;
}

/* ============================================
   FORMS
   ============================================ */
form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#to-account-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#add-account-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

label {
    font-size: 15px;
    font-weight: 500;
    color: #888888;
}

input, select {
    padding: 10px 12px;
    border: 1px solid #27272a;
    border-radius: 8px;
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    background: #18181b;
    color: #ffffff;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input::placeholder {
    color: #555555;
}

input:focus, select:focus {
    border-color: #f4f4f5;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

select option {
    background: #1a1a1a;
    color: #ffffff;
}

button[type="submit"], #toggle-button {
    background-color: #ffffff;
    color: #000000;
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    margin-top: 4px;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

button[type="submit"]:hover, #toggle-button:hover {
    background-color: #e5e5e5;
    transform: translateY(-1px);
}

button[type="submit"]:active, #toggle-button:active {
    transform: translateY(0);
}

/* ============================================
   TRANSACTIONS TABLE
   ============================================ */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

thead th {
    text-align: left;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #71717a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #202024;
}

tbody td {
    padding: 13px 14px;
    border-bottom: 1px solid #121214;
    color: #ffffff;
    font-size: 15px;
}

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

tbody tr:hover {
    background-color: #18181b;
}

tbody tr {
    animation: fadeIn 0.3s ease;
}

/* ============================================
   TRANSACTION TYPE COLOR CODING
   ============================================ */
tr.income td:nth-child(2) {
    color: #22c55e;
    font-weight: 600;
}

tr.expense td:nth-child(2) {
    color: #ef4444;
    font-weight: 600;
}

tr.transfer td:nth-child(2) {
    color: #3b82f6;
    font-weight: 600;
}

tbody td form button, tbody tr td form button {
    background: #ef4444 !important;
    border: 1px solid #222222;
    color: #ffffff !important;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    padding: 9px 20px;
    border-radius: 8px;
    transition: all 0.2s;
}

tbody td form button:hover, tbody tr td form button:hover {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
    color: #ffffff;
}

/* ============================================
   ERROR BANNER
   ============================================ */
.error-banner {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    padding: 12px 24px;
    text-align: center;
    font-weight: 600;
    font-size: 15px;
    border-bottom: 1px solid rgba(239, 68, 68, 0.2);
    width: 100%;
}

/* ============================================
   MODAL
   ============================================ */
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.2s ease;
}

#modal-box {
    background: #111111;
    border-radius: 12px;
    padding: 32px;
    width: 350px;
    border: 1px solid #222222;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
    text-align: center;
    animation: modalIn 0.2s ease;
}

#modal-message {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 6px;
}

#modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

#modal-cancel {
    padding: 9px 20px;
    border-radius: 8px;
    border: 1px solid #222222;
    background: #1a1a1a;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.2s;
}

#modal-cancel:hover {
    background: #222222;
}

#modal-confirm {
    padding: 9px 20px;
    border-radius: 8px;
    border: none;
    background: #ef4444;
    color: white;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.2s;
}

#modal-confirm:hover {
    background: #dc2626;
}

/* ============================================
   SORT & FILTER CONTROLS
   ============================================ */
#filter-controls {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

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

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: #888888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group select,
.filter-group input[type="month"] {
    padding: 8px 12px;
    border: 1px solid #222222;
    border-radius: 8px;
    font-size: 15px;
    background: #1a1a1a;
    color: #ffffff;
    outline: none;
    font-family: 'Inter', sans-serif;
}

#reset-link {
    padding: 9px 16px;
    border-radius: 8px;
    border: 1px solid #222222;
    background: #1a1a1a;
    color: #888888;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

#reset-link:hover {
    background: #222222;
    color: #ffffff;
}

/* ============================================
   TRANSACTIONS PAGE
   ============================================ */
.transactions-page {
    max-width: 1100px;
    margin: 28px auto;
    padding: 0 24px;
}

/* ============================================
   PAGINATION
   ============================================ */
#pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    font-size: 15px;
}

#pagination a {
    padding: 7px 14px;
    border-radius: 8px;
    background: #1a1a1a;
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    border: 1px solid #222222;
    transition: background 0.2s;
}

#pagination a:hover {
    background: #222222;
}

#pagination span {
    color: #888888;
    font-size: 12px;
}

#back-link {
    font-size: 15px;
    font-weight: 500;
    color: #888888;
    text-decoration: none;
    transition: color 0.2s;
}

#back-link:hover {
    color: #ffffff;
}

/* ============================================
   ANIMATIONS
   ============================================ */
#modal-box {
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

#add-account-wrapper {
    overflow: hidden;
    animation: slideDown 0.2s ease;
}

.edit-form {
    animation: slideDown 0.2s ease;
}

#to-account-wrapper {
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

#modal-overlay.hiding {
    animation: fadeOut 0.2s ease forwards;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* ============================================
   LOGIN PAGE
   ============================================ */
#login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #0a0a0a;
}

#login-box {
    background: #121214;
    border-radius: 16px;
    padding: 40px;
    width: 360px;
    border: 1px solid #202024;
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
}

#login-box h1 {
    font-size: 36px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.03em;
    text-align: center;
    margin-bottom: 6px;
}

#login-subtitle {
    text-align: center;
    color: #71717a;
    font-size: 15px;
    margin-bottom: 32px;
}

#auth-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 15px;
    color: #888888;
}

#auth-switch a {
    color: #ffffff; /* Bold white link */
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dashed #71717a; /* Clean underline detail */
}

#auth-switch a:hover {
    color: #e5e5e5;
    border-bottom-color: #ffffff;
}

/* ============================================
   LANDING PAGE
   ============================================ */
#landing-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #0a0a0a; 
}

#landing-box {
    max-width: 720px; 
    width: 90%;
    text-align: center;
    padding: 64px 40px;
}

#landing-box h1 {
    font-size: 68px;
    font-weight: 800; 
    color: #ffffff;
    margin-bottom: 24px;
    letter-spacing: -0.04em;
    line-height: 1.05;
    background: linear-gradient(180deg, #ffffff 0%, #a3a3a3 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#landing-subtitle {
    font-size: 22px; 
    font-weight: 400;
    color: #a3a3a3; 
    margin-bottom: 16px;
    line-height: 1.5;
}

#landing-desc {
    font-size: 16px;
    color: #666666; 
    line-height: 1.7;
    margin-bottom: 48px;
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
}

#landing-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.landing-btn {
    padding: 14px 32px; 
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.landing-btn.primary {
    background-color: #ffffff; 
    color: #000000;
    border: 1px solid #ffffff;
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.1);
}

.landing-btn.primary:hover {
    background-color: #e5e5e5;
    border-color: #e5e5e5;
    transform: translateY(-2px);
}

.landing-btn.secondary {
    background-color: transparent;
    color: #ffffff;
    border: 1px solid #262626;
}

.landing-btn.secondary:hover {
    background-color: #171717;
    border-color: #404040;
    transform: translateY(-2px);
}

/* ============================================
   HIDE MOBILE CARDS ON DESKTOP
   ============================================ */
.transaction-cards {
    display: none;
}

/* ============================================
   RESPONSIVE — MOBILE
   ============================================ */
@media (max-width: 768px) {

    main {
        grid-template-columns: 1fr;
        margin: 16px auto;
        padding: 0 16px;
        gap: 16px;
    }

    .transactions {
        grid-column: 1;
    }

    .transactions-page {
        padding: 0 16px;
        margin: 16px auto;
    }

    header {
        padding: 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    header h1 {
        font-size: 22px;
        letter-spacing: -0.02em;
    }

    #total-balance {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding-top: 12px;
        border-top: 1px solid #202024;
        margin-top: 0;
    }

    #total-amount {
        font-size: 20px;
    }

    input, select {
        width: 100%;
        font-size: 16px;
    }

    .account-cards {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .card {
        min-width: 100%;
        padding: 16px;
    }

    #filter-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .filter-group {
        width: 100%;
    }

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

    #filter-controls button[type="submit"],
    #reset-link {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
        padding: 12px;
    }

    .transactions table,
    .transactions thead,
    .transactions tbody,
    .transactions th,
    .transactions td,
    .transactions tr {
        display: none;
    }

    .transaction-cards {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .transaction-card {
        background: #121214;
        border-radius: 12px;
        padding: 16px;
        border: 1px solid #202024;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .transaction-card-top {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .transaction-card-date {
        font-size: 13px;
        color: #71717a;
    }

    .transaction-card-amount {
        font-size: 16px;
        font-weight: 700;
        color: #ffffff;
    }

    .transaction-card-amount.income  { color: #22c55e; }
    .transaction-card-amount.expense { color: #ef4444; }
    .transaction-card-amount.transfer { color: #3b82f6; }

    .transaction-card-middle {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .transaction-card-type {
        font-size: 15px;
        font-weight: 600;
        text-transform: capitalize;
        color: #fafafa;
    }

    .transaction-card-account {
        font-size: 15px;
        color: #888888;
    }

    .transaction-card-note {
        font-size: 13px;
        color: #71717a;
    }

    .transaction-card-bottom {
        display: flex;
        justify-content: flex-end;
        margin-top: 4px;
    }

    .transaction-card-bottom form button {
        padding: 8px 16px;
        font-size: 14px;
        width: auto;
    }

    #pagination {
        flex-wrap: wrap;
        gap: 8px;
    }

    #pagination a {
        flex: 1;
        text-align: center;
        padding: 10px;
    }

    #landing-box h1 {
        font-size: 42px;
        letter-spacing: -0.03em;
    }

    #landing-subtitle {
        font-size: 18px;
    }

    #landing-buttons {
        flex-direction: column;
        gap: 12px;
    }

    .landing-btn {
        width: 100%;
        text-align: center;
        padding: 14px;
    }

}