/* ===============================
   MATERIAL UI PREMIUM - DARK BLUE
   Fully Optimized Responsive 2025
================================ */

:root {
    --bg: #0a1220;
    --card: #101b2d;
    --card-lite: #132235;
    --muted: #9fb5c9;
    --accent: #2bd38b;
    --danger: #ff5964;
    --primary: #1ea3ff;
    --text: #e6eef6;
    --border: rgba(255, 255, 255, 0.08);
}

/* ===============================
   GLOBAL RESET
================================ */
* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, "Segoe UI", Roboto, Arial;
    -webkit-text-size-adjust: 100%;
    height: 100%;
    min-height: 100vh;
}

/* === GLOBAL FIX FOR iOS ZOOM === */
input,
select,
textarea,
button {
    font-size: 16px !important;
    /* prevent iOS zoom */
    touch-action: manipulation;
    -webkit-appearance: none;
}

/* ===============================
   LOGIN / REGISTER / FORGOT PASSWORD PAGES
================================ */
.login-page,
.register-page,
.forgot-page,
.reset-page {
    min-height: 100vh;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 22px;
}

/* Centered auth card */
.auth-card,
.login-card,
.register-card,
.forgot-card,
.reset-card {
    width: 100%;
    max-width: 380px;
    background: var(--card);
    padding: 26px;
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.55);
}

.auth-card h2,
.login-card h2,
.register-card h2,
.forgot-card h2,
.reset-card h2 {
    margin: 0 0 16px 0;
    font-size: 22px;
    font-weight: 700;
    text-align: center;
}

.auth-card input,
.login-card input,
.register-card input,
.forgot-card input,
.reset-card input {
    padding: 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    width: 100%;
    background: var(--card-lite);
    color: var(--text);
    margin-top: 8px;
    font-size: 16px !important;
}

.auth-link {
    text-align: center;
    display: block;
    margin-top: 14px;
    font-size: 14px;
    color: var(--primary);
}

/* ===============================
   LAYOUT + DASHBOARD
================================ */

.row {
    display: flex;
}

.gap8 {
    gap: 8px;
}

.gap10 {
    gap: 10px;
}

.mt10 {
    margin-top: 10px;
}

/* Container */
.container {
    max-width: 1280px;
    margin: 24px auto;
    padding: 0 14px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#site-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
}

.sub {
    font-size: 13px;
    color: var(--muted);
}

/* Buttons */
.btn {
    background: var(--card-lite);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 9px 12px;
    font-size: 14px;
    border-radius: 7px;
    cursor: pointer;
    transition: 0.15s;
}

.btn:hover {
    opacity: 0.85;
}

.btn.small {
    padding: 4px 6px;
    font-size: 12px;
}

.btn.primary {
    background: var(--primary);
    border: none;
    color: #fff;
}

.btn.danger {
    background: var(--danger);
    border: none;
    color: #fff;
}

.btn.ghost {
    background: transparent;
}

/* Toggle type buttons */
.toggle-type {
    flex: 1;
    text-align: center;
    padding: 10px 0;
}

.toggle-type.active {
    background: var(--primary);
    color: white;
}

/* Summary Grid */
.top-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

.card {
    background: var(--card);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.28);
}

.amount {
    font-size: 17px;
    font-weight: 600;
    margin-top: 10px;
}

.green {
    color: var(--accent);
}

.red {
    color: var(--danger);
}

.blue {
    color: #4aa3ff;
}

/* Main Grid */
.main-grid {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 18px;
}

/* Charts */
.chart-card {
    min-height: 320px;
}

.chart-container {
    width: 100%;
    height: 250px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#categoryChart {
    max-height: 250px !important;
    width: 100%;
}

#monthlyChart {
    width: 100%;
    max-height: 350px !important;
}

#categoryBreakdownChart {
    width: 100%;
    max-height: 380px !important;
}

/* Table */
.history-card {
    margin-top: 22px;
}

.controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.select {
    background: var(--card-lite);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 10px;
    border-radius: 7px;
}

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

#trans-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

#trans-table th.col-date {
    width: 110px;
}

#trans-table th.col-category {
    width: 180px;
}

#trans-table th.col-type {
    width: 70px;
    text-align: center;
}

#trans-table th.col-amount {
    width: 130px;
    text-align: right;
}

#trans-table th.col-note {
    width: 220px;
}

#trans-table th.col-actions {
    width: 120px;
    text-align: center;
}

#trans-table td:nth-child(3),
#trans-table td:nth-child(6) {
    text-align: center;
}

#trans-table td:nth-child(4) {
    text-align: right;
}

#trans-table th,
#trans-table td {
    padding: 10px;
    border-top: 1px solid var(--border);
}

.tx-income {
    color: var(--accent);
    font-weight: 600;
}

.tx-expense {
    color: var(--danger);
    font-weight: 600;
}

/* Floating Button */
.floating-add {
    position: fixed;
    right: 20px;
    bottom: 26px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 26px;
    cursor: pointer;
    z-index: 2000;
}

/* Modals */
.modal-hidden {
    position: fixed;
    inset: 0;
    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.55);
    z-index: 999;
}

.modal-card {
    width: 420px;
    max-width: 95%;
    background: var(--card);
    border-radius: 14px;
    border: 1px solid var(--border);
    padding: 22px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.55);
}

.modal-body input,
.modal-body select,
.modal-body textarea {
    width: 100%;
    padding: 12px;
    background: var(--card-lite);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    font-size: 15px !important;
}

/* ===============================
   RESPONSIVE
================================ */

@media (max-width: 980px) {
    .top-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .main-grid {
        grid-template-columns: 1fr;
    }

    .floating-add {
        width: 46px;
        height: 46px;
        font-size: 22px;
    }
}

@media (max-width: 480px) {

    #trans-table th,
    #trans-table td {
        font-size: 12px !important;
        white-space: normal !important;
        word-break: break-word;
    }

    #trans-table th.col-note {
        width: 120px;
    }

    #trans-table th.col-category {
        width: 140px;
    }

    #trans-table th.col-actions {
        width: 90px;
    }

    .modal-card {
        width: 94%;
        padding: 18px;
    }

    .row.gap10 {
        flex-direction: column;
    }

    .chart-container {
        height: 200px;
    }
}