/* ─── Reset / Base ─────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    height: auto;
    margin: 0;
    font-family: "Poppins", sans-serif;
    font-size: 15px;
    color: #212529;
    overflow-x: hidden;
    overflow-y: auto;
}

/* ─── Authenticated Shell ───────────────────────── */
.app-shell {
    min-height: 100vh;
    height: auto;
    position: relative;
}

.app-header .logo img {
    width: 90px;
}

.public-header img {
    width: 90px;
}
/* ─── Header (fixed top) ─────────────────────────── */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    background: #131324;
    color: #fff;
    z-index: 300;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

    .header-left .logo {
        display: flex;
        align-items: center;
        color: #fff;
        text-decoration: none;
        font-weight: 700;
        font-size: 1.2rem;
    }

        .header-left .logo:hover {
            color: #a9b4d2;
        }

/* Hamburger in header */
.header-sidebar-toggle {
    background: none;
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    margin-left: 100px;
    transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1), background 0.15s, color 0.15s;
}

    .header-sidebar-toggle:hover {
        background: rgba(255,255,255,0.1);
        color: #fff;
    }

.header-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Notification bell */
.header-icon-btn {
    position: relative;
    background: none;
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    transition: background 0.15s, color 0.15s;
}

    .header-icon-btn:hover {
        background: rgba(255,255,255,0.1);
        color: #fff;
    }

.notif-dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 8px;
    height: 8px;
    background: #f59e0b;
    border-radius: 50%;
    border: 2px solid #1a1a2e;
}

/* ─── User Menu Dropdown ────────────────────────── */
.user-menu {
    position: relative;
}

.user-menu-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.15s;
}

    .user-menu-btn:hover {
        background: rgba(255,255,255,0.08);
    }

/* User avatar circle */
.user-avatar-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #fff;
    flex-shrink: 0;
}

/* User name + role stacked text */
.user-info-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.user-display-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-display-role {
    font-size: 0.7rem;
    color: #94a3b8;
    white-space: nowrap;
}

.user-chevron {
    font-size: 0.7rem;
    color: #94a3b8;
    transition: transform 0.2s;
}

.user-menu-btn[aria-expanded="true"] .user-chevron {
    transform: rotate(180deg);
}

.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    width: max-content;
    min-width: 160px;
    z-index: 400;
    overflow: hidden;
}

.link2 {
    padding: 4px 14px;
    color: #000;
    text-decoration: none;
    font-size: 14px;
    display: inline-block;
}
    .user-dropdown.open {
        display: block;
    }

    .user-dropdown .user-email {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        color: #666;
        border-bottom: 1px solid #eee;
        word-break: break-all;
    }

    .user-dropdown .logout-btn {
        width: 100%;
        background: none;
        border: none;
        padding: 0.6rem 1rem;
        text-align: left;
        cursor: pointer;
        color: #dc3545;
        font-size: 0.9rem;
        transition: background 0.15s;
    }

        .user-dropdown .logout-btn:hover {
            background: #fff5f5;
        }

/* ─── Sidebar (fixed, between header and footer) ─── */
.app-sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    bottom: 0;
    width: 220px;
    background: #1a2333;
    color: #cdd3de;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 9999;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

    .app-sidebar.collapsed {
        width: 60px;
    }

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0.5rem 0.5rem 0;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: #cdd3de;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

    .sidebar-toggle:hover {
        background: rgba(255,255,255,0.1);
    }

    .sidebar-toggle svg {
        width: 18px;
        height: 18px;
        fill: currentColor;
    }

.nav-links {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0;
    flex: 1;
}

    .nav-links li {
        margin: 2px 8px;
    }

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.8rem;
    color: #94a3b8;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
    font-size: 0.88rem;
    font-weight: 400;
}

    .nav-link i,
    .nav-link svg {
        font-size: 1.05rem;
        width: 18px;
        height: 18px;
        fill: currentColor;
        flex-shrink: 0;
    }

    .nav-link:hover {
        background: rgba(255,255,255,0.06);
        color: #e2e8f0;
    }

    .nav-link.active {
        background: linear-gradient(90deg, #c83477 0%, #f3ba54 100%);
        color: #fff;
        font-weight: 500;
    }

        .nav-link.active i,
        .nav-link.active svg {
            color: #fff;
        }

.app-sidebar.collapsed .nav-link .link-label {
    display: none;
}

.app-sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 0.5rem 0 0;
}

/* ─── Sidebar Help Box ──────────────────────────── */
.sidebar-help-box {
    margin: 1rem 10px;
    padding: 1rem;
    background: rgba(255,255,255,0.06);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

    .help-box-inner .help-title {
        font-size: 0.82rem;
        font-weight: 600;
        color: #e2e8f0;
        margin: 0 0 0.25rem;
    }

    .help-box-inner .help-desc {
        font-size: 0.72rem;
        color: #64748b;
        margin: 0 0 0.6rem;
        line-height: 1.4;
    }

    .help-docs-btn {
        display: inline-flex;
        align-items: center;
        gap: 0.3rem;
        padding: 0.35rem 0.75rem;
        background: #1e3a5f;
        color: #93c5fd;
        border-radius: 6px;
        font-size: 0.75rem;
        font-weight: 500;
        text-decoration: none;
        transition: background 0.15s;
    }

        .help-docs-btn:hover {
            background: #1e4080;
            color: #bfdbfe;
        }

.app-sidebar.collapsed .sidebar-help-box {
    display: none;
}

/* ─── Main Content (offset by header/sidebar/footer) ─ */
/* ─── Main Content ──────────────────────────────── */
.app-content {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    height: auto;
    min-height: calc(100vh - 60px);
    margin-left: 220px;
    display: flex;
    flex-direction: column;
    padding: 1.75rem 2rem 0;
    overflow: visible;
    background: #f8fafc;
    transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-sidebar.collapsed ~ .app-content {
    margin-left: 60px;
}

/* app-body ab sirf ek non-flex wrapper hai, koi layout role nahi */
.app-body {
    position: relative;
    min-height: calc(100vh - 60px);
    height: auto;
    padding-top: 60px;
}
.header-sidebar-toggle.collapsed-toggle {
    margin-left: 0;
}

/* ─── Footer (fixed bottom) ──────────────────────── */
.app-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    margin-top: auto;
    padding: 1rem;
    background: #1a2333;
    color: #ffffff;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    font-size: 1rem;
    line-height: 1.4;
    letter-spacing: 0.01em;
    flex: 0 0 auto;
}

/* ─── Public Shell ──────────────────────────────── */
.public-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #f4f6f9;
}

.public-header {
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    height: 56px;
    background: #1a1a2e;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

    .public-header .logo {
        color: #fff;
        text-decoration: none;
        font-weight: 700;
        font-size: 1.2rem;
        letter-spacing: 0.5px;
    }

        .public-header .logo:hover {
            color: #a9b4d2;
        }

.public-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

/* ─── Auth Cards (Login / Register) ────────────── */
.auth-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 1.1rem 1.1rem;
    width: 100%;
    max-width: 420px;
}

    .auth-card h1 {
        font-size: 1.5rem;
        font-weight: 700;
        margin-bottom: 0.25rem;
        color: #1a1a2e;
    }

    .auth-card .subtitle {
        font-size: 0.875rem;
        color: #888;
        margin-bottom: 1.75rem;
    }

/* ─── Form Utilities ────────────────────────────── */
.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: #444;
}

.form-control:focus {
    border-color: #0f3460;
    box-shadow: 0 0 0 3px rgba(15,52,96,0.15);
}

.btn-primary {
    background: #0f3460;
    border-color: #0f3460;
}

    .btn-primary:hover {
        background: #0a2647;
        border-color: #0a2647;
    }

/* ─── Alerts ────────────────────────────────────── */
.alert-logout-error {
    position: fixed;
    top: 64px;
    right: 1rem;
    z-index: 1000;
    max-width: 320px;
}

/* ─── Page Content Headers ──────────────────────── */
.page-header {
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e0e4ea;
}

    .page-header h1 {
        font-size: 1.5rem;
        font-weight: 600;
        color: #1a1a2e;
        margin: 0;
    }

.page-subtitle {
    margin: 0.35rem 0 0;
    color: #6c757d;
    font-size: 0.95rem;
}

.nav-section {
    margin: 20px 14px 10px;
    list-style: none;
}

.nav-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin: 6px;
}

.app-sidebar.collapsed .nav-section-title {
    display: none;
}

.nav-section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(148, 163, 184, .25);
}



.auth-card a {
    color: #0f3460;
    text-decoration: none;
}







/* Transactions Grid - Mobile Responsive */
#transactionsGrid {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

    /* GridJS container */
    #transactionsGrid .gridjs-container {
        width: 100% !important;
    }

    /* Allow table to keep proper column widths */
    #transactionsGrid .gridjs-wrapper {
        overflow-x: auto;
        overflow-y: hidden;
    }

    /* Prevent columns from becoming extremely narrow */
    #transactionsGrid .gridjs-table {
        width: max-content !important;
        min-width: 100%;
    }

    /* Keep cell content readable */
    #transactionsGrid .gridjs-th,
    #transactionsGrid .gridjs-td {
        white-space: nowrap;
    }

    /* Date column */
    #transactionsGrid th[data-column-id="date"],
    #transactionsGrid td[data-column-id="date"] {
        min-width: 145px !important;
    }

    /* Type column */
    #transactionsGrid th[data-column-id="type"],
    #transactionsGrid td[data-column-id="type"] {
        min-width: 80px !important;
    }

    /* Amount column */
    #transactionsGrid th[data-column-id="amount"],
    #transactionsGrid td[data-column-id="amount"] {
        min-width: 90px !important;
    }

    /* Balance column */
    #transactionsGrid th[data-column-id="balanceAfter"],
    #transactionsGrid td[data-column-id="balanceAfter"] {
        min-width: 120px !important;
    }

    /* Description column */
    #transactionsGrid th[data-column-id="description"],
    #transactionsGrid td[data-column-id="description"] {
        min-width: 180px !important;
    }

    /* Source column */
    #transactionsGrid th[data-column-id="source"],
    #transactionsGrid td[data-column-id="source"] {
        min-width: 100px !important;
    }

    /* API Key column */
    #transactionsGrid th[data-column-id="apiKey"],
    #transactionsGrid td[data-column-id="apiKey"] {
        min-width: 120px !important;
    }



@media (max-width: 700px) {
    .app-body {
        padding-top: 60px;
    }

    .app-content {
        min-height: calc(100vh - 60px);
        margin-left: 0;
        padding: 1.25rem 1rem 0;
    }

    .app-sidebar.collapsed ~ .app-content {
        margin-left: 0;
    }

    .app-footer {
        min-height: 52px;
        padding: 0.85rem 0.75rem;
        font-size: 0.72rem;
    }

    .header-sidebar-toggle {
        margin-left: 0;
    }
}

