/* ================= 1. VARIABLES ================= */
:root {
    --bg-main: #eff6f6;
    --sidebar-text: #64748b;
    --active-pill: #002d2d;
    --card-shadow: 0 10px 30px rgba(0,0,0,0.04);
    --radius-lg: 30px;
}

/* ================= 2. GLOBAL RESET ================= */
* {
    box-sizing: border-box; /* Critical for layout math */
}

body {
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* Stops horizontal scroll */
}

/* ================= 3. WORDPRESS ADMIN FIXES ================= */
#wpbody-content { padding: 0 !important; }
#adminmenuwrap, #adminmenuback { display: none !important; }
#wpcontent { margin-left: 0 !important; padding: 0 !important; }

/* PC ONLY: Handle Admin Bar (Push Sidebar down 32px) */
@media screen and (min-width: 769px) {
    body.admin-bar .df-sidebar { 
        top: 32px; 
        height: calc(100vh - 32px); 
    }
    body.admin-bar .df-header { 
        top: 32px; 
    }
}

/* ================= 4. LAYOUT WRAPPER ================= */
.df-wrapper {
    background: var(--bg-main);
    font-family: 'Plus Jakarta Sans', sans-serif;
    display: flex;
    min-height: 100vh;
    width: 100%;
    position: relative;
}

/* ================= 5. SIDEBAR (PC FIXED) ================= */
.df-sidebar {
    width: 280px !important;
    background: #fff;
    position: fixed; /* Always Fixed on PC */
    top: 0;
    bottom: 0;
    left: 0;
    padding: 30px 20px;
    border-right: 1px solid #eee;
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s ease; /* Only animate transform for mobile */
}

.df-side-logo {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.side-nav-group {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    margin: 25px 0 10px 15px;
    letter-spacing: 1px;
}

.df-side-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    text-decoration: none;
    color: var(--sidebar-text);
    font-weight: 600;
    border-radius: 18px;
    margin-bottom: 5px;
    transition: 0.3s;
}

.df-side-item.active, .df-side-item:hover {
    background: var(--active-pill);
    color: white;
    box-shadow: 0 10px 20px rgba(0, 45, 45, 0.2);
}

/* ================= 6. MAIN CONTENT (PC) ================= */
.df-main {
    flex: 1;
    /* Forces content to sit to the right of the 280px sidebar */
    margin-left: 280px !important; 
    width: calc(100% - 280px) !important;
    
    padding: 30px 50px;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* HEADER */
.df-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
    flex-wrap: wrap;
}

/* MOBILE TOGGLE BUTTON (HIDDEN ON PC) */
.mobile-toggle-btn {
    display: none; /* Hide on PC */
    font-size: 28px;
    cursor: pointer;
    color: var(--active-pill);
    padding: 5px;
}

.search-bar {
    background: white;
    padding: 10px 20px;
    border-radius: 50px;
    width: 100%;
    max-width: 400px;
    display: flex;
    align-items: center;
    box-shadow: var(--card-shadow);
}
.search-bar input {
    border: none !important;
    background: transparent;
    outline: none;
    margin-left: 10px;
    width: 100%;
}

.user-profile { display: flex; align-items: center; gap: 15px; }
.user-profile img { width: 45px; height: 45px; border-radius: 15px; object-fit: cover; }
.welcome-text { font-size: 32px; font-weight: 800; margin-bottom: 30px; }

/* ================= 7. GRIDS & TABLES ================= */
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 25px; margin-bottom: 40px; }
.summary-card { padding: 30px; border-radius: var(--radius-lg); box-shadow: var(--card-shadow); position: relative; overflow: hidden; min-height: 160px; }
.card-light-green { background: #e2f4d3; } .card-light-blue { background: #d2f1f1; } .card-light-pink { background: #fcd5d9; }
.summary-card h3 { font-size: 28px; font-weight: 800; margin: 10px 0; }

.pos-analytics-grid { display: grid; grid-template-columns: 380px 1fr; gap: 24px; margin: 20px 0; width: 100%; }
.pos-chart-card { background: #f1f8f9; border-radius: 35px; padding: 25px; position: relative; border: 1px solid rgba(0,0,0,0.05); min-height: 480px; display: flex; flex-direction: column; }
.doughnut-inner-box { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -60%); background: #ffffff; width: 120px; height: 90px; border-radius: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 10px 20px rgba(0,0,0,0.02); }
.pos-floating-tip { position: absolute; top: 30px; right: 30px; background: #1e293b; color: white; padding: 12px 20px; border-radius: 18px; z-index: 5; text-align: right; }

.df-table-container { background: white; padding: 35px; border-radius: var(--radius-lg); box-shadow: var(--card-shadow); overflow-x: auto; }
.modern-table { width: 100%; min-width: 600px; border-collapse: separate; border-spacing: 0 10px; }
.modern-table th { padding: 15px; text-align: left; }
.modern-table td { padding: 20px 15px; border-bottom: 1px solid #f8fafc; }


/* ================= 8. MEDIA QUERIES (MOBILE) ================= */

/* TABLET (1024px and below) */
@media screen and (max-width: 1024px) {
    .df-sidebar { width: 220px !important; }
    .df-main { margin-left: 220px !important; width: calc(100% - 220px) !important; padding: 30px; }
    .summary-grid { grid-template-columns: repeat(2, 1fr); }
    .pos-analytics-grid { grid-template-columns: 1fr; }
}

/* MOBILE (768px and below) */
@media screen and (max-width: 768px) {
    
    /* 1. RESET MAIN CONTENT (Full Width) */
    .df-main {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 20px 15px !important;
    }

    /* 2. HIDE SIDEBAR INITIALLY (Off-screen) */
    .df-sidebar {
        transform: translateX(-100%); /* Hides it */
        width: 260px !important;
        left: 0 !important;
        top: 0 !important; /* Ignore Admin Bar on Mobile */
        height: 100vh !important;
        z-index: 99999;
        box-shadow: 10px 0 30px rgba(0,0,0,0.1);
    }

    /* 3. SHOW SIDEBAR (When JS adds this class) */
    .df-sidebar.mobile-active {
        transform: translateX(0);
    }

    /* 4. SHOW MENU ICON */
    .mobile-toggle-btn { 
        display: block !important; 
        margin-bottom: 20px;
    }

    /* 5. COMPONENTS ADJUSTMENT */
    .df-header { flex-direction: column; align-items: flex-start; }
    .search-bar { max-width: 100%; }
    .summary-grid { grid-template-columns: 1fr; }
    .welcome-text { font-size: 24px; }
    .df-table-container { padding: 20px; }

    /* 6. BLACK OVERLAY */
    .body-overlay {
        position: fixed; top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 9900;
        display: none;
    }
    .body-overlay.active { display: block; }
}

.df-sub-item{
    display:block;
    padding:6px 12px;
    margin:4px 0;
    font-size:14px;
    color:#475569;
    text-decoration:none;
    border-radius:6px;
}
.df-sub-item:hover{
    background:#f1f5f9;
}
.df-sub-item.active{
    background:#0c831f;
    color:#fff;
    font-weight:600;
}

