/* =========================
   ROOT THEME VARIABLES
========================= */
:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --text: #1e1e1e;
    --primary: #2563eb;
    --border: #e5e7eb;
    --sidebar-bg: #111827;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #ffffff;
    --topbar-bg: #ffffff;
    --footer-bg: #ffffff;
}

/* DARK MODE OVERRIDE (client only) */
body.dark {
    --bg: #0f172a;
    --surface: #111827;
    --text: #e5e7eb;
    --border: #1f2937;
    --sidebar-bg: #0b1220;
    --sidebar-text: #94a3b8;
    --sidebar-active: #ffffff;
    --topbar-bg: #111827;
    --footer-bg: #111827;
}

/* =========================
   GLOBAL RESET
========================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

    body.public-layout {
        background: var(--bg);
    }

/* =========================
   CLIENT LAYOUT WRAPPER
========================= */
.layout {
    display: flex;
    flex: 1;
    min-height: calc(100vh - 60px);
}

/* =========================
   SIDEBAR (FIXED BASE)
========================= */
.sidebar {
    width: 250px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    padding: 20px 0;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.25s ease, background 0.25s ease;
}

    .sidebar .menu {
        list-style: none;
        padding: 0;
        margin: 0;
    }

        /* Base Menu Link Style (Locks Height to stop jumping) */
        .sidebar .menu li a {
            display: flex;
            align-items: center;
            gap: 12px;
            height: 46px;
            padding: 0 20px;
            color: var(--sidebar-text);
            text-decoration: none;
            transition: 0.2s;
        }

            .sidebar .menu li a:hover {
                background: rgba(255, 255, 255, 0.06);
                color: var(--sidebar-active);
            }

/* Toggle button */
.sidebar-toggle {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    font-size: 22px;
    padding: 10px 20px;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
}

/* =========================
   SIDEBAR COLLAPSE SYSTEM
========================= */
.sidebar.collapsed {
    width: 70px;
}

    /* Centering overrides when collapsed */
    .sidebar.collapsed .sidebar-toggle {
        justify-content: center;
        padding: 10px 0;
    }

    .sidebar.collapsed .menu li a {
        justify-content: center;
        padding: 0;
        gap: 0;
    }

        /* Hide text span cleanly */
        .sidebar.collapsed .menu li a span {
            display: none !important;
        }

    .sidebar.collapsed .menu li button span {
        display: none !important;
    }

/* =========================
   CLIENT CONTENT AREA
========================= */
.content {
    margin-left: 250px;
    padding: 20px;
    flex: 1;
    transition: margin-left 0.25s ease;
}

.sidebar.collapsed + .content {
    margin-left: 70px;
}

/* =========================
   TOP NAV & FOOTER
========================= */
.dashboard-topbar {
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border);
}

.navbar a,
.navbar span {
    color: var(--text) !important;
}

.app-footer {
    background: var(--footer-bg);
    border-top: 1px solid var(--border);
    color: var(--text);
    padding: 15px 0;
    text-align: left;
}

/* =========================
   RESPONSIVE (MOBILE)
========================= */
@media (max-width: 768px) {
    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
    }

        .sidebar.collapsed {
            width: 100%;
        }

    .content {
        margin-left: 0;
    }

    .sidebar.collapsed + .content {
        margin-left: 0;
    }

    .layout {
        flex-direction: column;
    }
}

/* Hide toggle button text when collapsed */
.sidebar.collapsed .sidebar-toggle span {
    display: none !important;
}

.sidebar-toggle span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    max-width: 150px; /* Adjust this width to fit your layout */
}

.dashboard-topbar {
    margin-left: 250px;
    transition: margin-left 0.25s;
}

body:has(.sidebar.collapsed) .dashboard-topbar {
    margin-left: 70px;
}

html, body {
    height: 100dvh !important;
    overflow: hidden !important;
}

/* 1. Glue the footer to the bottom of the screen */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
}

/* 2. Stop the main content from pushing past the screen */
main {
    height: 80dvh;
    overflow-y: auto; /* If text is too long, only this middle part will scroll internally */
}

/* Replace '.sidebar' with whatever your sidebar's actual class name is */
.sidebar {
    position: relative; /* or 'fixed' / 'absolute' if it already has one */
    z-index: 999 !important;
}

/* Apply these rules ONLY if it is NOT the public layout */
body:not(.public-layout) {
    height: 100dvh !important;
    overflow: hidden !important;
}

    body:not(.public-layout) .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        height: 100dvh !important;
        z-index: 9999 !important;
    }

    body:not(.public-layout) .dashboard-topbar {
        margin-left: 250px !important;
        transition: margin-left 0.25s !important;
    }

body:has(.sidebar.collapsed) .dashboard-topbar {
    margin-left: 70px !important;
}

body:not(.public-layout) .content {
    height: calc(100dvh - 60px) !important;
    overflow-y: auto !important;
    padding-bottom: 80px !important;
}

body:not(.public-layout) .app-footer {
    position: fixed !important;
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    z-index: 900 !important;
    margin-left: 250px !important;
    transition: margin-left 0.25s ease !important;
}

body:has(.sidebar.collapsed) .app-footer {
    margin-left: 70px !important;
}

/* Add this to override the purple gradient when dark mode is active */
body.dark .sidebar {
    background: #000000;
}

/* Slightly highlight table rows on hover in dark mode */
body.dark .table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

    /* Change all text and links to light grey when a row is hovered in dark mode */
    body.dark .table-hover tbody tr:hover,
    body.dark .table-hover tbody tr:hover td,
    body.dark .table-hover tbody tr:hover a {
        color: #cbd5e1 !important; /* Premium light grey */
    }

.azampay-pill-badge {
    display: inline-block;
    background-color: #e6f7ee; /* Light mint background tint */
    color: #14854c; /* AzamPay signature green text */
    border: 1px solid #bfead4; /* Soft, thin green border */
    border-radius: 50px; /* Perfect pill/capsule shape */
    padding: 8px 24px; /* Slim top/bottom, wider sides */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    font-weight: 500; /* Clean, legible text weight */
    text-align: center;
}

.sticky-pricing-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: #fff;
}

    .sticky-pricing-header th {
        background-color: #fff;
        vertical-align: middle;
    }

/* ========================================================
   FLOATING SUBMENU PATCH WHEN SIDEBAR IS COLLAPSED
   ======================================================== */

/* Prevent the narrow 70px sidebar from clipping the popup context */
body:not(.public-layout) .sidebar.collapsed {
    overflow: visible !important;
}

/* Force list wrappers to release absolute child constraints */
.sidebar.collapsed .menu {
    overflow: visible !important;
}

.sidebar.collapsed .has-submenu {
    position: relative !important;
}

/* Convert the standard vertical submenu into a clean floating panel */
.sidebar.collapsed .submenu {
    position: absolute !important;
    left: 100% !important; /* Positions flush right against the 70px sidebar line */
    top: 0 !important;
    width: 220px !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important; /* Preserves your branding identity gradient */
    box-shadow: 4px 4px 15px rgba(0, 0, 0, 0.25) !important;
    border-radius: 0 8px 8px 0 !important;
    padding: 8px 0 !important;
    margin: 0 !important;
    z-index: 999999 !important; /* Mounts safely over data grid tables */
}

    /* Ensure submenu bullet points are styled legibly inside the popup context */
    .sidebar.collapsed .submenu li {
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

        .sidebar.collapsed .submenu li a {
            display: block !important;
            width: 100% !important;
            height: auto !important;
            padding: 10px 20px !important;
            text-align: left !important;
            justify-content: flex-start !important;
            color: #ffffff !important; /* High contrast visibility override */
        }

            .sidebar.collapsed .submenu li a:hover {
                background: rgba(255, 255, 255, 0.15) !important;
            }

body:has(.sidebar.collapsed) .content {
    margin-left: 70px !important;
}

.sidebar.collapsed .submenu-chevron {
    display: none !important;
}



#logoutBtn {
    all: unset;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 46px;
    padding: 0 20px;
    width: 100%;
    color: var(--sidebar-text);
    cursor: pointer;
    transition: 0.2s;
    box-sizing: border-box;
}

    #logoutBtn:hover {
        background: rgba(255, 255, 255, 0.06);
        color: var(--sidebar-active);
    }

.sidebar.collapsed #logoutBtn {
    justify-content: center;
    padding: 0;
}

    .sidebar.collapsed #logoutBtn span {
        display: none !important;
    }

.sticky-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f8f9fa;
}

.table-responsive {
    max-height: 70vh;
    overflow-y: auto;
    /* hide scrollbar - Firefox */
    scrollbar-width: none;
    /* IE/Edge legacy */
    -ms-overflow-style: none;
}

    /* hide scrollbar - Chrome, Safari, Edge */
    .table-responsive::-webkit-scrollbar {
        width: 0;
        height: 0;
    }

/* ========================================================
   SUBMENU SMOOTH FADE ANIMATION
   ======================================================== */
/* Isolated animation state for floating submenus */
.submenu-fade-out {
    opacity: 0 !important;
    transition: opacity 0.5s ease-out !important;
}

.alert {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
    width: 25%; /* Change to 100% for full width */
    margin-left: auto; /* Keeps it aligned to the right if you use 25% */
}