/* =========================
   GLOBAL
========================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f7fb;
    color: #172033;
}


/* =========================
   DASHBOARD
========================= */

.dashboard {
    width: min(1100px, 92%);
    margin: 0 auto;
    padding: 35px 0 60px;
}


/* =========================
   TOP BAR
========================= */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
}

.topbar h1 {
    font-size: 30px;
    font-weight: 700;
}

.subtitle {
    color: #718096;
    margin-top: 5px;
}


/* =========================
   LOGOUT
========================= */

.logout-button {
    border: none;
    background: #172033;
    color: white;

    padding: 11px 20px;

    border-radius: 10px;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    transition: 0.2s;
}

.logout-button:hover {
    background: #2d3748;
    transform: translateY(-1px);
}


/* =========================
   WELCOME
========================= */

.welcome-section {
    margin-bottom: 22px;
}

.welcome-section h2 {
    font-size: 25px;
    margin-bottom: 6px;
}

.welcome-section p {
    color: #718096;
}


/* =========================
   ACCOUNT CARD
========================= */

.account-card {
    background: white;

    border: 1px solid #e6eaf0;

    border-radius: 16px;

    padding: 20px 24px;

    display: flex;
    gap: 70px;

    margin-bottom: 20px;

    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
}

.account-card div {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.label {
    font-size: 12px;
    color: #8a94a6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


/* =========================
   BALANCE
========================= */

.balance-card {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);

    color: white;

    border-radius: 20px;

    padding: 30px;

    margin-bottom: 22px;

    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.25);
}

.balance-title {
    font-size: 15px;
    opacity: 0.85;
}

.balance-card h2 {
    font-size: 42px;
    margin: 10px 0;
}

.balance-subtitle {
    font-size: 13px;
    opacity: 0.75;
}


/* =========================
   QUICK ACTIONS
========================= */

.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;

    margin-bottom: 22px;
}

.action-card {
    background: white;

    border: 1px solid #e6eaf0;

    border-radius: 16px;

    padding: 25px;

    cursor: pointer;

    transition: 0.2s;

    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
}

.action-card:hover {
    transform: translateY(-3px);

    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.action-icon {
    font-size: 28px;
    margin-bottom: 12px;
}

.action-card h3 {
    margin-bottom: 6px;
}

.action-card p {
    color: #718096;
    font-size: 14px;
}


/* =========================
   TRANSACTIONS
========================= */

.transactions-card {
    background: white;

    border: 1px solid #e6eaf0;

    border-radius: 18px;

    padding: 25px;

    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 25px;
}

.section-header h2 {
    font-size: 20px;
}

.section-header p {
    color: #718096;
    font-size: 14px;
    margin-top: 5px;
}

.view-all-button {
    border: 1px solid #dce2ea;

    background: white;

    padding: 9px 15px;

    border-radius: 9px;

    cursor: pointer;

    font-weight: 600;

    transition: 0.2s;
}

.view-all-button:hover {
    background: #f4f7fb;
}


/* =========================
   EMPTY TRANSACTIONS
========================= */

.empty-transactions {
    text-align: center;

    padding: 45px 20px;

    border: 1px dashed #d7dde7;

    border-radius: 14px;
}

.empty-icon {
    font-size: 35px;
    margin-bottom: 12px;
}

.empty-transactions h3 {
    margin-bottom: 7px;
}

.empty-transactions p {
    color: #718096;
    font-size: 14px;
}


/* =========================
   MOBILE
========================= */

@media (max-width: 700px) {

    .dashboard {
        width: 94%;
        padding-top: 25px;
    }

    .topbar {
        align-items: flex-start;
    }

    .topbar h1 {
        font-size: 24px;
    }

    .account-card {
        flex-direction: column;
        gap: 18px;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .balance-card h2 {
        font-size: 34px;
    }

}

/* =========================
   LOGIN & REGISTER PAGES
========================= */

body:has(.register-container) {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 16px;
    background:
        radial-gradient(ellipse at top left, #dbeafe 0%, transparent 45%),
        radial-gradient(ellipse at bottom right, #e0e7ff 0%, transparent 45%),
        #f4f7fb;
    color: #172033;
}

/* Main authentication card */

.register-container {
    width: 100%;
    max-width: 440px;
    padding: 42px 38px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid #e5eaf3;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(31, 55, 100, 0.12);
    animation: authAppear 0.45s ease-out;
}

/* Heading */

.register-container h1 {
    font-size: 30px;
    letter-spacing: -0.8px;
    margin-bottom: 10px;
    color: #172033;
}

/* Supporting text */

.register-container > p {
    color: #718096;
    font-size: 14px;
    line-height: 1.7;
    margin-top: 18px;
}

/* Form layout */

.register-container form {
    display: flex;
    flex-direction: column;
    margin-top: 28px;
}

/* Labels */

.register-container label {
    color: #344054;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

/* Inputs */

.register-container input {
    width: 100%;
    padding: 13px 14px;
    margin-bottom: 20px;
    border: 1px solid #dce3ed;
    border-radius: 11px;
    background: #f9fafc;
    color: #172033;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.register-container input:hover {
    border-color: #b9c7dc;
}

.register-container input:focus {
    background: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

/* Main button */

.register-container form button {
    width: 100%;
    padding: 14px;
    margin-top: 4px;
    border: none;
    border-radius: 11px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 7px 16px rgba(37, 99, 235, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}

.register-container form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 11px 22px rgba(37, 99, 235, 0.3);
}

.register-container form button:active {
    transform: translateY(0);
}

/* Links */

.register-container a {
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
}

.register-container a:hover {
    text-decoration: underline;
}

/* Error / status message */

#message {
    overflow-wrap: anywhere;
    font-size: 14px;
    color: #dc2626;
}

/* Entrance animation */

@keyframes authAppear {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Small screens */

@media (max-width: 480px) {
    .register-container {
        padding: 32px 23px;
        border-radius: 20px;
    }

    .register-container h1 {
        font-size: 26px;
    }
}

/* Respect reduced-motion preferences */

@media (prefers-reduced-motion: reduce) {
    .register-container {
        animation: none;
    }

    .register-container input,
    .register-container form button {
        transition: none;
    }
}

/* =========================
   AUTH BRANDING
========================= */

.auth-page {
    width: 100%;
    max-width: 440px;
}

.brand-heading {
    text-align: center;
    margin-bottom: 24px;
}

.brand-icon {
    width: 58px;
    height: 58px;

    margin: 0 auto 12px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: linear-gradient(135deg, #3b82f6, #1d4ed8);

    border-radius: 17px;

    font-size: 28px;

    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.22);
}

.brand-heading h1 {
    font-size: 30px;
    letter-spacing: -0.8px;
    color: #172033;
}

.brand-heading p {
    margin-top: 5px;
    color: #718096;
    font-size: 14px;
}
.register-container h2 {
    font-size: 25px;
    color: #172033;
    letter-spacing: -0.5px;
}
/* =========================
   SOCIAL LOGIN
========================= */

.social-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 18px;
    color: #98a2b3;
    font-size: 11px;
    font-weight: 600;
}

.social-divider::before,
.social-divider::after {
    content: "";
    height: 1px;
    background: #e4e8ef;
    flex: 1;
}

.social-button {
    width: 100%;
    height: 48px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 11px;

    margin-bottom: 12px;

    background: white;
    color: #344054;

    border: 1px solid #dce3ed;
    border-radius: 11px;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    transition: 0.2s;
}

.social-button:hover {
    background: #f8fafc;
    border-color: #b9c7dc;
    transform: translateY(-1px);
}

.social-logo {
    font-size: 19px;
    font-weight: 700;
}

.google-button .social-logo {
    font-family: Arial, sans-serif;
}

.microsoft-logo {
    font-size: 22px;
}


/* ===== Transaction Form and History ===== */

[hidden] {
    display: none !important;
}

.action-card {
    width: 100%;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
    border: 1px solid rgba(128, 128, 128, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.action-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
}

.transaction-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.transaction-form label {
    font-weight: 600;
    margin-top: 6px;
}

.transaction-form input,
.transaction-form select {
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: white;
    color: #111827;
    font: inherit;
}

.transaction-form input:focus,
.transaction-form select:focus {
    outline: 2px solid #93c5fd;
    border-color: #2563eb;
}

.transaction-form button[type="submit"] {
    margin-top: 12px;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    background: #2563eb;
    color: white;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.transaction-form button[type="submit"]:disabled {
    opacity: 0.6;
    cursor: wait;
}

#transactionMessage {
    color: #b91c1c;
    overflow-wrap: anywhere;
}

.transactions-list {
    display: flex;
    flex-direction: column;
}

.transaction-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid #e5e7eb;
}

.transaction-row:last-child {
    border-bottom: none;
}

.transaction-details {
    min-width: 0;
}

.transaction-details h3 {
    margin: 0 0 5px;
    font-size: 1rem;
}

.transaction-details p {
    margin: 4px 0;
    overflow-wrap: anywhere;
}

.transaction-date {
    color: #6b7280;
    font-size: 0.85rem;
}

.transaction-income {
    color: #15803d;
    white-space: nowrap;
}

.transaction-expense {
    color: #dc2626;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .transaction-row {
        align-items: flex-start;
        gap: 8px;
    }

    .transaction-row strong {
        font-size: 0.9rem;
    }
}

/* ===============================
   MoneyTracker AI Chat
================================ */

.ai-chat-toggle {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 62px;
    height: 62px;
    border: none;
    border-radius: 50%;
    background: #2563eb;
    color: white;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
    z-index: 1000;
    transition: transform 0.2s, background 0.2s;
}

.ai-chat-toggle:hover {
    background: #1d4ed8;
    transform: translateY(-3px);
}

.ai-chat-window {
    position: fixed;
    right: 24px;
    bottom: 100px;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 480px;
    max-height: calc(100vh - 130px);
    background: #ffffff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 999;
}

.ai-chat-window[hidden] {
    display: none;
}

.ai-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #2563eb;
    color: white;
}

.ai-chat-header h2 {
    margin: 0 0 4px;
    font-size: 17px;
}

.ai-chat-header p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

.ai-chat-header button {
    border: none;
    background: transparent;
    color: white;
    font-size: 22px;
    cursor: pointer;
}

.ai-chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-message {
    max-width: 88%;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.ai-message-bot {
    align-self: flex-start;
    background: #f3f4f6;
    color: #1f2937;
}

.ai-message-user {
    align-self: flex-end;
    background: #2563eb;
    color: white;
}

.ai-chat-form {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #e5e7eb;
}

.ai-chat-form input {
    flex: 1;
    min-width: 0;
    padding: 11px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    outline: none;
}

.ai-chat-form input:focus {
    border-color: #2563eb;
}

.ai-chat-form button {
    padding: 10px 14px;
    border: none;
    border-radius: 10px;
    background: #2563eb;
    color: white;
    cursor: pointer;
}

.ai-chat-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ai-chat-note {
    margin: 0;
    padding: 0 12px 10px;
    text-align: center;
    color: #6b7280;
    font-size: 11px;
}

@media (max-width: 480px) {
    .ai-chat-window {
        right: 16px;
        bottom: 90px;
        width: calc(100vw - 32px);
    }

    .ai-chat-toggle {
        right: 16px;
        bottom: 16px;
    }
}

/* Savings Goals Planner */
.savings-goals-section {
    margin-top: 24px;
}

.savings-goals-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 20px;
}

.savings-goal-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    background: #fff;
    color: #111827;
}

.savings-goal-card h3 {
    margin: 0 0 8px;
    overflow-wrap: anywhere;
}

.savings-goal-meta {
    color: #6b7280;
    font-size: 13px;
    margin: 5px 0;
}

.savings-goal-progress-track {
    height: 10px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
    margin: 12px 0;
}

.savings-goal-progress-fill {
    height: 100%;
    width: 0;
    background: #2563eb;
    border-radius: 999px;
    transition: width 0.3s ease;
}

.savings-goal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.savings-goal-actions button {
    padding: 9px 12px;
    border: 0;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    cursor: pointer;
}

.savings-goal-actions button:hover {
    background: #1d4ed8;
}

.savings-goal-actions button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.savings-goal-update {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.savings-goal-update input {
    flex: 1;
    min-width: 120px;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
}

.savings-goal-plan {
    margin-top: 12px;
    padding: 12px;
    background: #f3f4f6;
    border-radius: 10px;
    white-space: pre-wrap;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

#goalFormMessage {
    margin-top: 10px;
    font-size: 14px;
}

@media (max-width: 600px) {
    .savings-goal-card {
        padding: 12px;
    }

    .savings-goal-actions button {
        flex: 1;
    }
}


/* MoneyTracker Footer */
.site-footer {
    text-align: center;
    padding: 24px 16px;
    margin: 24px auto 0;
    color: #6b7280;
    font-size: 14px;
    border-top: 1px solid #e5e7eb;
}

.site-footer a {
    display: inline-block;
    margin: 8px 0;
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

.site-footer a:hover {
    text-decoration: underline;
}

.site-footer .footer-tagline {
    margin-top: 6px;
    font-size: 12px;
    opacity: 0.85;
}
