@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-color: #f8fafc;
    --surface: #ffffff;
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --secondary: #0ea5e9;
    --accent: #f43f5e;
    --income: #10b981;
    --expense: #f43f5e;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --sidebar-w: 250px;
    --radius: 20px;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --glass: rgba(255, 255, 255, 0.7);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    font-family: 'Outfit', 'Hind Siliguri', sans-serif;
    color: var(--text-main);
    overflow-x: hidden;
    line-height: 1.4;
    font-size: 14.5px;
}

/* Base Layout Wrapper */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid #e2e8f0;
    padding: 25px 18px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo-container {
    padding: 0 15px 40px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-box {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 22px;
    box-shadow: 0 8px 16px var(--primary-glow);
}

.logo-txt {
    font-weight: 800;
    font-size: 22px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.nav-links {
    list-style: none;
    flex: 1;
}

.nav-item {
    margin-bottom: 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 14px;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    transition: all 0.2s;
}

.nav-link:hover {
    background: #f1f5f9;
    color: var(--primary);
    transform: translateX(5px);
}

.nav-link.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 8px 20px var(--primary-glow);
}

.nav-link.active i {
    color: white;
}

.nav-link i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 35px;
    width: 100%;
    max-width: 1400px;
    margin-right: auto;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
        padding: 25px;
        padding-bottom: 110px;
    }

    .bottom-nav {
        display: flex !important;
    }
}

/* Bottom Nav for Mobile */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 25px;
    left: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(15px);
    border-radius: 24px;
    padding: 12px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.bottom-link {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 22px;
    width: 55px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.bottom-link.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 8px 15px var(--primary-glow);
    transform: translateY(-8px);
}

/* Dashboard Cards & Stats */
.top-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--surface);
    padding: 26px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    transition: 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card.primary {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
}

.stat-label {
    font-size: 15px;
    font-weight: 600;
    opacity: 0.9;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -1px;
}

.stat-icon-bg {
    position: absolute;
    right: -15px;
    bottom: -15px;
    font-size: 90px;
    opacity: 0.12;
    transform: rotate(-10deg);
}

/* Premium Balance Card (from style.balance.css) */
.balance-card {
    background: var(--surface);
    padding: 35px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.balance-label {
    font-size: 16px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 10px;
}

.balance-amount {
    font-size: 52px;
    font-weight: 800;
    letter-spacing: -1.5px;
    line-height: 1.1;
    z-index: 2;
}

.balance-amount.income {
    color: var(--income);
    background: linear-gradient(135deg, #10b981, #059669);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.balance-amount.expense {
    color: var(--expense);
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.balance-icon-bg {
    position: absolute;
    right: -25px;
    bottom: -35px;
    font-size: 160px;
    opacity: 0.08;
    transform: rotate(-15deg);
    pointer-events: none;
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.balance-card:hover .balance-icon-bg {
    transform: rotate(0deg) scale(1.1);
    opacity: 0.15;
}

/* Page Header & Back Button */
.header-with-back {
    display: flex;
    align-items: center;
    gap: 18px;
}

.back-btn {
    width: 40px;
    height: 40px;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6366f1;
    text-decoration: none;
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 14px;
}

.back-btn:hover {
    background: #e2e8f0;
    transform: scale(1.1);
}

.page-title {
    font-size: 25px;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
    line-height: 1.2;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 600;
    display: block;
    margin-top: 2px;
}

/* User Profile Header */
.user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
}

/* List/Grid Sections */
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.section-title h2 {
    font-size: 21px;
    font-weight: 800;
}

/* Account Cards Grid */
.list-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 25px;
}

.account-card {
    background: var(--surface);
    padding: 22px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s;
    border: 1px solid #f1f5f9;
    box-shadow: var(--shadow);
}

.account-card:hover {
    border-color: var(--primary);
    transform: translateY(-8px);
    box-shadow: 0 20px 30px rgba(0, 0, 0, 0.08);
}

.account-icon {
    width: 60px;
    height: 60px;
    background: #f1f5f9;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--primary);
    transition: 0.3s;
}

.account-card:hover .account-icon {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
}

.account-info {
    flex: 1;
}

.account-name {
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 4px;
}

.account-meta {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.account-bal {
    font-weight: 800;
    font-size: 18px;
    text-align: right;
    letter-spacing: -0.5px;
}

/* Transaction List (Merged and Refined) */
.txn-list-wrapper {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0;
    overflow: hidden;
    border: 1px solid #f1f5f9;
}

.txn-item {
    padding: 18px 22px;
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 18px;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s;
}

.txn-item:last-child {
    border-bottom: none;
}

.txn-item:hover {
    background: #f8fafc;
}

.txn-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: 0.3s;
}

.txn-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}

.txn-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.txn-meta-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge-type {
    background: #e2e8f0;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.8px;
}

.txn-date {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.txn-amount-box {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 100px;
}

.txn-val {
    font-weight: 800;
    font-size: 16px;
    letter-spacing: -0.5px;
}

.txn-running-bal {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 600;
}

.delete-btn {
    color: #cbd5e1;
    font-size: 16px;
    padding: 10px;
    border-radius: 12px;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.delete-btn:hover {
    background: #fee2e2;
    color: #ef4444;
    transform: scale(1.1);
}

@media (max-width: 600px) {
    .txn-item {
        padding: 15px 20px;
        grid-template-columns: auto 1fr auto;
        gap: 15px;
    }

    .txn-val {
        font-size: 16px;
    }

    .txn-item .delete-btn {
        display: none;
        /* Accessible in edit modal usually */
    }
}

/* FAB */
.fab-btn {
    width: 54px;
    height: 54px;
    background: var(--primary);
    color: white;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    border: none;
    box-shadow: 0 10px 20px var(--primary-glow);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fab-btn:hover {
    transform: scale(1.1) rotate(90deg);
    background: var(--secondary);
}

/* Auth Pages */
.auth-body {
    background: radial-gradient(circle at top right, #eef2ff, #f8fafc);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 25px;
}

.auth-card {
    background: white;
    width: 100%;
    max-width: 400px;
    padding: 40px;
    border-radius: 28px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.auth-logo {
    width: 62px;
    height: 62px;
    background: var(--primary);
    color: white;
    font-size: 28px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 22px;
    box-shadow: 0 12px 25px var(--primary-glow);
}

.auth-title {
    font-size: 25px;
    font-weight: 800;
    margin-bottom: 8px;
}

.auth-subtitle {
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 35px;
}

/* Forms */
.form-group {
    margin-bottom: 25px;
    text-align: left;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-main);
    margin-left: 5px;
}

.form-input {
    width: 100%;
    padding: 14px 18px;
    background: #f8fafc;
    border: 2px solid #f1f5f9;
    border-radius: 14px;
    font-size: 14.5px;
    transition: all 0.3s;
    font-family: inherit;
    color: var(--text-main);
}

.form-input:focus {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 5px var(--primary-glow);
    outline: none;
}

.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 18px;
    color: var(--text-muted);
    font-size: 16px;
    pointer-events: none;
}

.input-with-icon {
    padding-left: 48px !important;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 20px var(--primary-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px var(--primary-glow);
    background: #4f46e5;
}

.auth-link {
    display: inline-block;
    margin-top: 25px;
    color: var(--text-muted);
    font-size: 15px;
    text-decoration: none;
}

.auth-link span {
    color: var(--primary);
    font-weight: 800;
}

/* Custom Select Styling */
select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 18px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    opacity: 0;
    transition: all 0.3s ease;
    padding: 20px;
}

.modal-overlay.show {
    opacity: 1;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 420px;
    border-radius: 24px;
    padding: 20px;
    position: relative;
    transform: scale(0.9) translateY(40px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.3);
    max-height: 98vh;
    overflow: hidden;
}

.modal-overlay.show .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.modal-title {
    font-size: 18px;
    font-weight: 800;
}

.modal-close {
    background: #f1f5f9;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: 0.3s;
    font-size: 14px;
}

.modal-close:hover {
    background: #fee2e2;
    color: var(--expense);
    transform: rotate(90deg);
}

/* Transaction Specifics in Modal */
.modal-content .form-group {
    margin-bottom: 8px;
}

.modal-content .form-label {
    margin-bottom: 6px;
    font-size: 13px;
}

.modal-content .form-row {
    grid-template-columns: 1fr;
    gap: 8px;
}

.modal-content .input-with-icon {
    padding-left: 40px !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    font-size: 14px;
}

.modal-content .input-icon {
    left: 15px;
    font-size: 14px;
}

.type-toggle {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 10px;
    gap: 4px;
}

.type-btn {
    flex: 1;
    padding: 8px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s;
    font-size: 14px;
    color: var(--text-muted);
}

.type-btn.active.income {
    background: var(--income);
    color: #ffffff !important;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.type-btn.active.expense {
    background: var(--expense);
    color: #ffffff !important;
    box-shadow: 0 8px 20px rgba(244, 63, 94, 0.4);
}

.type-btn i {
    font-size: 14px;
}

/* Transaction Specific Cards */
.transaction-card {
    background: white;
    border-radius: 28px;
    padding: 30px;
    box-shadow: var(--shadow);
    max-width: 600px;
    margin: 0 auto;
}

.amount-input-group {
    background: #f8fafc;
    padding: 8px;
    border-radius: 16px;
    border: 2px solid #f1f5f9;
    margin-bottom: 10px;
    position: relative;
    text-align: center;
}

.amount-input {
    width: 60%;
    padding: 2px;
    font-size: 28px;
    font-weight: 800;
    text-align: center;
    background: transparent;
    border: none;
    color: var(--text-main);
    outline: none;
}

.amount-currency {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 13px;
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Helpers */
.income {
    color: var(--income) !important;
}

.expense {
    color: var(--expense) !important;
}

.positive {
    color: var(--income) !important;
}

.negative {
    color: var(--expense) !important;
}

.text-bangla {
    font-family: 'Hind Siliguri', sans-serif;
}

.d-none {
    display: none !important;
}

@media (min-width: 768px) {
    .d-md-block {
        display: block !important;
    }

    .d-md-none {
        display: none !important;
    }
}

/* Animations */
@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.animate-up {
    animation: slideInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

/* Flash Box */
#flash-box {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    z-index: 9999;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: opacity 0.5s;
}