@font-face {
    font-family: 'SiyamRupali';
    src: local('Siyam Rupali'), local('SiyamRupali'),
        url('https://cdn.jsdelivr.net/gh/ronniesong0211/bangla-fonts@main/Siyam%20Rupali.woff2') format('woff2'),
        url('https://cdn.jsdelivr.net/gh/ronniesong0211/bangla-fonts@main/Siyam%20Rupali.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'SolaimanLipi';
    src: local('Solaiman Lipi'), local('SolaimanLipi'),
        url('https://cdn.jsdelivr.net/gh/ronniesong0211/bangla-fonts@main/SolaimanLipi_20-04-07.woff2') format('woff2'),
        url('https://cdn.jsdelivr.net/gh/ronniesong0211/bangla-fonts@main/SolaimanLipi_20-04-07.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg-main: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --success: #059669;
    /* Slightly deeper emerald */
    --danger: #dc2626;
    /* Slightly deeper red */
    --success-light: rgba(5, 150, 105, 0.1);
    --danger-light: rgba(220, 38, 38, 0.1);
    --sidebar-bg: #ffffff;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius: 12px;
}

[data-theme="dark"] {
    --bg-main: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --sidebar-bg: #1e293b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'SiyamRupali', 'SolaimanLipi', 'Noto Sans Bengali', 'Inter', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    font-weight: bold;
    font-size: 14px;
    line-height: 1.4;
    transition: background-color 0.3s ease;
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.sidebar {
    width: 100%;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    position: relative;
    height: auto;
    z-index: 100;
}

.main-content {
    flex: 1;
    margin-left: 0;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Sidebar Styling -> Top Header Styling */
.logo {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-item {
    margin-bottom: 0;
}

.nav-link,
.btn-nav {
    display: flex;
    align-items: center;
    padding: 0.6rem 1rem;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 8px;
    transition: all 0.2s;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    white-space: nowrap;
    height: 40px;
    /* Uniform height */
}

.nav-link:hover,
.nav-link.active {
    background: var(--primary);
    color: white;
}

.btn-nav-primary {
    background: var(--primary);
    color: white;
}

.btn-nav-primary:hover {
    background: var(--primary-hover);
}

.menu-toggle {
    display: none;
    font-size: 1.5rem;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.5rem;
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .nav-wrapper {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--sidebar-bg);
        border-bottom: 1px solid var(--border-color);
        padding: 1rem;
        flex-direction: column;
        gap: 0.5rem;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    }

    .nav-wrapper.show {
        display: flex;
    }

    .nav-links {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }

    .nav-item {
        width: 100%;
    }

    .nav-link,
    .btn-nav {
        width: 100% !important;
        justify-content: flex-start;
        height: 44px;
        /* Uniform height for touch */
    }
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.welcome-text h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

.welcome-text p {
    color: var(--text-muted);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1.2;
}

.stat-footer {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
}

.footer-item {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
}

.footer-item strong {
    color: var(--text-main);
    font-size: 0.95rem;
}

/* Activity Specific */
.activity-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.activity-badge {
    padding: 0.35rem 0.85rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-due {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fee2e2;
}

.badge-payment {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #d1fae5;
}

.activity-main {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

.activity-symbol {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-muted);
}

.activity-amount {
    font-size: 1.5rem;
    font-weight: 900;
}

.activity-footer {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Tables */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9375rem;
}

tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Buttons */
.btn {
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

/* Mobile Responsive Transformations */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 1rem;
    }

    .app-container {
        flex-direction: column;
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }

    .logo {
        margin-bottom: 1rem;
    }

    .nav-links {
        display: flex;
        overflow-x: auto;
        gap: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .nav-item {
        margin-bottom: 0;
    }

    .nav-link {
        white-space: nowrap;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .profile-header-card {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
        padding: 1.5rem;
    }

    .profile-user-info {
        flex-direction: column;
    }

    .profile-avatar {
        width: 60px;
        height: 60px;
        font-size: 1.75rem;
    }

    .profile-text h1 {
        font-size: 1.5rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .activity-amount {
        font-size: 1.6rem;
    }

    /* Premium Modern Compact Ledger - Mobile */
    .ledger-table,
    .ledger-table thead,
    .ledger-table tbody,
    .ledger-table th,
    .ledger-table td,
    .ledger-table tr {
        display: block;
        width: 100%;
    }

    .ledger-table thead {
        display: none;
    }

    .ledger-table tr {
        margin-bottom: 1rem;
        padding: 1.25rem;
        padding-left: 1.25rem;
        border: 1px solid rgba(0, 0, 0, 0.05);
        background: #ffffff;
        border-radius: 16px;
        position: relative;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    }

    .ledger-table tr::before {
        content: '';
        position: absolute;
        left: 0;
        top: 15%;
        bottom: 15%;
        width: 4px;
        border-radius: 0 4px 4px 0;
    }

    .row-due::before {
        background: var(--danger);
    }

    .row-payment::before {
        background: var(--success);
    }

    .ledger-table td {
        border: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0 !important;
        font-size: 0.9rem;
    }

    /* Date - Small and subtle */
    .ledger-table td:first-child {
        display: block;
        text-align: left;
        font-size: 0.7rem;
        font-weight: 500;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 1px;
        margin-bottom: 0.25rem;
        padding: 0 !important;
    }

    /* Description/Note - The Title */
    .ledger-table td:nth-child(2) {
        display: block;
        text-align: left;
        font-weight: 700;
        font-size: 1.1rem;
        color: var(--text-muted);
        padding: 0 !important;
        margin-bottom: 1rem;
        line-height: 1.4;
    }

    /* Financial Rows - Area Styling */
    .ledger-table td:nth-child(n+3) {
        background: rgba(0, 0, 0, 0.015);
        padding: 0.6rem 0.8rem !important;
        margin-bottom: 0.4rem;
        border-radius: 8px;
        color: #000;
        font-weight: 800;
    }

    .ledger-table td::before {
        content: attr(data-label);
        font-size: 0.65rem;
        font-weight: 700;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    /* Custom color for amounts */
    .ledger-table td[data-label="বাকি (Due)"] {
        color: var(--danger) !important;
        font-weight: 800;
        margin-top: 0.8rem;
    }

    .ledger-table td[data-label="জমা (Payment)"] {
        color: var(--success) !important;
        font-weight: 800;
    }

    .row-total {
        background: var(--primary) !important;
        border: none !important;
        padding-left: 1.25rem !important;
    }

    .row-total td {
        color: rgba(255, 255, 255, 0.9) !important;
        background: none !important;
    }

    .row-total td::before {
        color: rgba(255, 255, 255, 0.7) !important;
    }
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    animation: modalSlide 0.3s ease-out;
}

@keyframes modalSlide {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-main);
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.btn-block {
    width: 100%;
    justify-content: center;
    padding: 1rem;
}

/* Activity Styling */
.activity-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.badge-due {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-payment {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.activity-amount {
    font-weight: 800;
    font-size: 1.4rem;
    display: block;
    margin-top: 0.25rem;
}

.activity-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}