
html, body {
    overflow-x: hidden;
}

/* TOPBAR */
.dash-topbar {
    display: none; /* hidden on desktop */
    height: 60px;
    background: white;
    padding: 0 20px;
    border-bottom: 1px solid #eee;
    align-items: center;
}

/* Toggle button (mobile only) */
.dash-toggle {
    font-size: 32px;
    cursor: pointer;
    user-select: none;
    color: var(--primary);
}

.dash-title {
    font-size: 20px;
    font-weight: 700;
}

/* OVERLAY */
#dash-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: none;
    z-index: 40;
}

/* MOBILE SIDEBAR (hidden by default) */
@media (max-width: 900px) {

    /* Show topbar */
    .dash-topbar {
        display: flex;
    }

    /* Sidebar hidden offscreen */
    .sidebar {
        left: -260px;
        height: 100vh;
        z-index: 200;
        box-shadow: 3px 0 10px rgba(0,0,0,0.1);
    }

    /* Slide in when active */
    .sidebar.show {
        left: 0;
    }

    /* Overlay visible */
    #dash-overlay.show {
        display: block;
    }

    /* Allow content to move down under topbar */
    .dashboard-content {
        margin-top: 60px;
    }
}


/* DASHBOARD LAYOUT */

.layout {
    display: flex;
    min-height: 100vh;
    background: var(--light);
}

/* SIDEBAR */

.sidebar {
    width: 240px;
    background: var(--white);
    border-right: 1px solid #e5e7eb;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    text-align: center;
    margin-bottom: 20px;
}

.sidebar-logo {
    height: 60px;
    margin-bottom: 10px;
}

.sidebar-header h2 {
    font-family: "Poppins", sans-serif;
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: var(--blue);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    margin-top: 10px;
}

.nav-link {
    padding: 12px 14px;
    margin-bottom: 8px;
    text-decoration: none;
    color: var(--dark);
    font-size: 15px;
    border-radius: 6px;
}

.nav-link:hover {
    background: #eef2ff;
    color: var(--blue);
}

.nav-link.active {
    background: var(--blue);
    color: #fff;
}

.logout {
    margin-top: auto;
    color: #b91c1c;
}

.logout:hover {
    background: #fecaca;
}

/* MAIN */

.main {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    padding: 20px;
    box-sizing: border-box; /* prevents padding overflow */
    flex: 1;
    padding: 30px;
}

.page-title {
    font-family: "Poppins", sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 20px;
}

/* METRICS */

.metrics {
    display: flex;
    
    gap: 20px;
    margin-bottom: 40px;
}

.metric-card {
    flex: 1;
    background: var(--white);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.07);
}

.metric-card h3 {
    margin: 0;
    font-family: "Poppins";
    color: var(--blue);
}

.metric-card p {
    margin-top: 8px;
    font-size: 22px;
    font-weight: 700;
}

/* PURCHASE LIST */

.section-title {
    font-family: "Poppins";
    font-size: 22px;
    margin-bottom: 20px;
    color: var(--dark);
}

.purchase-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.purchase-card {
    background: var(--white);
    padding: 18px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    display: flex;
    gap: 18px;
    align-items: center;
}
.purchase-card {
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}


.purchase-thumb {
    width: 95px;
    height: 135px;
    object-fit: cover;
    border-radius: 8px;
}

.purchase-info h3 {
    margin: 0;
    font-family: "Poppins";
    font-size: 18px;
}

.purchase-info p {
    margin: 3px 0;
    color: var(--text);
    font-size: 14px;
}

/* PROFILE CARD */

.profile-card {
    background: var(--white);
    max-width: 450px;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

.profile-card h2 {
    font-family: "Poppins";
    font-size: 22px;
    margin-bottom: 18px;
}

.profile-card .input-group {
    margin-bottom: 18px;
}

.profile-card .input-group label {
    font-weight: 600;
    color: var(--dark);
}

.profile-card .input-group input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    font-size: 15px;
}

/* EMPTY STATE ------------------------------------------------------- */

.empty-state {
    background: var(--white);
    padding: 40px;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    text-align: center;
    margin-top: 20px;
}

.empty-state h3 {
    font-family: "Poppins";
    font-size: 20px;
    color: var(--dark);
    margin-top: 10px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text);
    margin-top: 6px;
    margin-bottom: 20px;
}

.empty-btn {
    background: var(--blue);
    color: #fff;
    padding: 12px 24px;
    display: inline-block;
    border-radius: 8px;
    text-decoration: none;
    font-family: "Poppins";
    font-weight: 600;
}

.empty-btn:hover {
    background: #1740b0;
}

.empty-icon {
    width: 120px;
    opacity: 0.7;
}


/* RESPONSIVEness code */

/* Topbar for mobile */
.dash-topbar {
    display: none;
    background: var(--white);
    border-bottom: 1px solid #e5e7eb;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.dash-toggle {
    font-size: 26px;
    cursor: pointer;
    color: var(--blue);
}

#dash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.45);
    display: none;
    z-index: 900;
}

/* Sidebar base */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 1000;
    transform: translateX(0);
    transition: transform 0.3s ease-in-out;
}

/* MAIN AREA */
.main {
    margin-left: 100px;
    padding: 30px;
    width: 100%;
}

@media (max-width: 900px) {
    .metrics {
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        align-items: center;
        width: 100%;
        overflow-x: hidden;
    }

    .metric-card {
        width: 100% !important;
        max-width: 400px !important;
        flex: none !important;    /* ⬅ KEY FIX */
        box-sizing: border-box;
    }
}




/* ===== MOBILE RULES ===== */
@media (max-width: 900px) {
    .layout{
        flex-direction: column;
    }
    h1,h2,h3{
        font-size: 11px !important;
    }

    /* show topbar */
    .dash-topbar {
        display: flex;
    }

    /* hide sidebar initially */
    .sidebar {
        transform: translateX(-100%);
        width: 240px;
        height: 100vh;
        position: fixed;
    }

    /* show when open */
    .sidebar.open {
        transform: translateX(0);
    }

    /* overlay visible when sidebar open */
    #dash-overlay.show {
        display: block;
    }

    /* main content full width */
    .main {
        margin-left: 0;
        padding: 20px;
    }
}