/**
 * Gripar Dashboard – Stylesheet
 * Version: 6.0.0  (UI/UX redesign – world-class professional)
 *
 * Visual language : modern enterprise SaaS dashboard.
 * Sidebar         : deep slate gradient (#0B1220 → #1E293B) with indigo accent.
 * Workspace       : warm-cool off-white (#F6F8FB) with floating white cards.
 * Cards           : soft shadow, 14px radius, gradient icon chips.
 * All IDs/classes : preserved – no markup or JS changes required.
 */

/* ================================================================
   0. Tokens
   ================================================================ */
:root {
    --gp-bg:          #EEF1F6;   /* slightly cooler/darker so header stands out */
    --gp-surface:     #FFFFFF;
    --gp-border:      #D9DFEA;
    --gp-border-soft: #E8ECF3;

    --gp-text:        #0F172A;
    --gp-text-mute:   #64748B;
    --gp-text-soft:   #94A3B8;

    --gp-accent:      #6366F1;
    --gp-accent-2:    #8B5CF6;
    --gp-accent-soft: rgba(99, 102, 241, 0.10);

    --gp-success:     #10B981;
    --gp-warn:        #F59E0B;
    --gp-danger:      #EF4444;

    --gp-shadow-xs:   0 1px 2px rgba(15, 23, 42, 0.04);
    --gp-shadow-sm:   0 2px 6px rgba(15, 23, 42, 0.06);
    --gp-shadow-md:   0 8px 24px -8px rgba(15, 23, 42, 0.12),
                      0 2px 6px rgba(15, 23, 42, 0.04);
    --gp-shadow-lg:   0 20px 40px -20px rgba(15, 23, 42, 0.18),
                      0 8px 16px -8px rgba(15, 23, 42, 0.08);

    --gp-radius:      14px;
    --gp-radius-sm:   10px;
    --gp-ease:        cubic-bezier(0.22, 0.61, 0.36, 1);

    --gp-sidebar-w:        296px;
    --gp-sidebar-w-collapsed: 76px;
    --gp-header-h:         64px;
}

/* ================================================================
   1. Break out of Blocksy / Gutenberg constraints (kept from v5)
   ================================================================ */
.site-main .ct-container-full[data-content="normal"],
.site-main .ct-container {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    --theme-content-vertical-spacing: 0px !important;
}

.entry-content.is-layout-constrained,
.entry-content.is-layout-constrained > * {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.wp-block-columns,
.wp-block-column {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    flex-basis: 100% !important;
}

/* ================================================================
   2. Page shell – full-bleed flex layout
   ================================================================ */
/* FIX (6.0.1): the old 100vw + margin-left:calc(50% - 50vw) breakout assumed the
   parent was centered in the viewport. On pages built with Gutenberg Group/Columns
   blocks the parent is a left-aligned, content-size column (e.g. 1440px), so the
   calc went negative and pushed the whole shell (and sidebar) off-screen left.
   100vw also included the scrollbar → horizontal scroll. Now: stretch every block
   wrapper that contains #gp-page, and let #gp-page simply be 100% wide. */
:where(.entry-content, .wp-block-group, .wp-block-columns, .wp-block-column):has(#gp-page) {
    max-width: 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}
.wp-block-group.is-layout-grid:has(#gp-page) { display: block !important; }

#gp-page {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 0 !important;

    display: flex !important;
    flex-wrap: nowrap !important;
    flex-direction: row !important;
    align-items: stretch !important;
    box-sizing: border-box !important;

    background: var(--gp-bg);
    color: var(--gp-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
                 Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.005em;
    min-height: 100vh;
}

/* ================================================================
   3. Sidebar
   ================================================================ */
#gp-page-sidebar {
    width: var(--gp-sidebar-w) !important;
    min-width: var(--gp-sidebar-w) !important;
    max-width: var(--gp-sidebar-w) !important;
    flex: 0 0 var(--gp-sidebar-w) !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    z-index: 100 !important;

    /* PROFESSIONAL FLAT — clean deep slate, no glows.
       Matches gp-left-menu.css theme-sidebar. */
    background: linear-gradient(180deg, #0F172A 0%, #0B1120 100%) !important;
    color: rgba(226, 232, 240, 0.92);
    box-shadow:
        inset -1px 0 0 rgba(255, 255, 255, 0.04),
        4px 0 24px -16px rgba(15, 23, 42, 0.55);
}

.gp-left-menu-container {
    width: 100% !important;
    min-width: 100% !important;
    background: transparent !important;
}

/* Sidebar brand — icon stacked above name, centered */
.gp-sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding: 22px 14px 18px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 4px;
}

/* Brand <a> wrapper (inline style from PHP currently uses flex-row) —
   force it to also stack so the icon/text alignment is consistent. */
.gp-sidebar-brand > a,
.gp-sidebar-brand .gp-dynamic-ft-link {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center;
    gap: 10px !important;
}

.gp-brand-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--gp-accent), var(--gp-accent-2));
    color: #fff;
    font-size: 18px;
    /* Subtle inner highlight only — no big glow halo */
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.14),
        0 4px 10px -4px rgba(99, 102, 241, 0.35);
}

.gp-brand-text {
    color: #fff;
    font-weight: 700;
    font-size: 14.5px;
    line-height: 1.25;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ================================================================
   4. Right pane
   ================================================================ */
#gp-page-right {
    width: calc(100% - var(--gp-sidebar-w)) !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    background: var(--gp-bg);
}

/* ================================================================
   5. Header
   ================================================================ */
#gp-page-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    /* Soft slate gradient (not pure white) so the dashboard header is clearly
       distinct from the WordPress theme header that may sit above it. */
    background: linear-gradient(180deg, #F7F9FC 0%, #EEF2F8 100%) !important;
    backdrop-filter: saturate(150%) blur(10px);
    -webkit-backdrop-filter: saturate(150%) blur(10px);
    padding: 0 24px !important;
    height: var(--gp-header-h);
    min-height: var(--gp-header-h);
    border-bottom: 1px solid var(--gp-border) !important;
    /* Layered shadow + 1px highlight on the top edge for clear elevation. */
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55),
                0 1px 0 rgba(15, 23, 42, 0.04),
                0 8px 20px -12px rgba(15, 23, 42, 0.18);
    width: 100% !important;
    box-sizing: border-box !important;
    position: sticky;
    top: 0;
    z-index: 50;
}

/* Email chip — bump up so it reads on the slate header background */
#gp-page-header .gp-header-email {
    background: #FFFFFF;
    border-color: var(--gp-border);
    box-shadow: var(--gp-shadow-xs);
}

.gp-header-left {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 14px !important;
}

.gp-header-right {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

.gp-header-left h1 {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 19px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    color: var(--gp-text) !important;
    letter-spacing: -0.015em;
}

/* User email chip */
.gp-header-email {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: #F1F5F9;
    color: var(--gp-text-mute);
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 500;
    border: 1px solid var(--gp-border-soft);
}
.gp-header-email::before {
    content: '';
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gp-accent), var(--gp-accent-2));
    display: inline-block;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25),
                0 4px 10px -4px rgba(99,102,241,0.5);
}

.gp-header-role {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    background: var(--gp-accent-soft);
    color: var(--gp-accent);
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Badges */
.gp-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1;
}
.gp-badge-active {
    background: rgba(16, 185, 129, 0.12);
    color: var(--gp-success);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

/* Buttons */
.gp-btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: linear-gradient(180deg, #EF4444, #DC2626);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s var(--gp-ease),
                box-shadow 0.2s var(--gp-ease),
                filter    0.2s var(--gp-ease);
    box-shadow: 0 6px 14px -6px rgba(239, 68, 68, 0.55),
                inset 0 1px 0 rgba(255,255,255,0.18);
}
.gp-btn-danger:hover  { filter: brightness(1.05); transform: translateY(-1px); }
.gp-btn-danger:active { transform: translateY(0); }

/* Toggle button — visible on desktop AND mobile.
   Desktop click → collapse/expand the sidebar.
   Mobile click  → open/close the drawer (handled in dashboard.js). */
.gp-mobile-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: var(--gp-surface) !important;
    border: 1px solid var(--gp-border) !important;
    border-radius: 10px !important;
    color: var(--gp-text) !important;
    font-size: 15px !important;
    cursor: pointer !important;
    box-shadow: var(--gp-shadow-xs);
    transition: background-color 0.2s var(--gp-ease),
                color            0.2s var(--gp-ease),
                transform        0.2s var(--gp-ease);
}
.gp-mobile-toggle:hover {
    background: #F8FAFC !important;
    color: var(--gp-accent) !important;
}
.gp-mobile-toggle:active { transform: scale(0.95); }

/* Close-X is only used inside the mobile drawer */
.gp-sidebar-close-btn { display: none !important; }

/* ================================================================
   6.5. Sidebar — transitions for collapse/expand
   ================================================================ */
#gp-page-sidebar,
#gp-page-right {
    transition: width 0.28s var(--gp-ease),
                min-width 0.28s var(--gp-ease),
                max-width 0.28s var(--gp-ease),
                flex-basis 0.28s var(--gp-ease);
}

/* ================================================================
   6.6. COLLAPSED SIDEBAR (icon-only rail, desktop only)
   Trigger: .gp-sidebar-collapsed on #gp-page
   ================================================================ */
@media (min-width: 769px) {
    #gp-page.gp-sidebar-collapsed #gp-page-sidebar {
        width: var(--gp-sidebar-w-collapsed) !important;
        min-width: var(--gp-sidebar-w-collapsed) !important;
        max-width: var(--gp-sidebar-w-collapsed) !important;
        flex: 0 0 var(--gp-sidebar-w-collapsed) !important;
    }
    #gp-page.gp-sidebar-collapsed #gp-page-right {
        width: calc(100% - var(--gp-sidebar-w-collapsed)) !important;
    }

    /* Brand: keep icon, hide name */
    #gp-page.gp-sidebar-collapsed .gp-sidebar-brand {
        justify-content: center;
        padding: 18px 0 14px 0;
        gap: 0;
    }
    #gp-page.gp-sidebar-collapsed .gp-brand-text { display: none !important; }

    /* Menu rows: center icon, hide everything else */
    #gp-page.gp-sidebar-collapsed .gp-left-menu-link,
    #gp-page.gp-sidebar-collapsed .gp-left-menu-action {
        justify-content: center !important;
        padding: 10px 0 !important;
    }
    #gp-page.gp-sidebar-collapsed .gp-left-menu-icon {
        margin-right: 0 !important;
    }
    #gp-page.gp-sidebar-collapsed .gp-left-menu-text,
    #gp-page.gp-sidebar-collapsed .gp-left-menu-arrow {
        display: none !important;
    }

    /* Hide section eyebrow labels — render as a short divider line instead */
    #gp-page.gp-sidebar-collapsed .gp-left-menu-label {
        height: 1px;
        padding: 0 !important;
        margin: 10px 16px !important;
        background: rgba(255, 255, 255, 0.08);
        overflow: hidden;
        font-size: 0 !important;
    }
    #gp-page.gp-sidebar-collapsed .gp-left-menu-label * { display: none !important; }

    /* Collapse all expanded submenus */
    #gp-page.gp-sidebar-collapsed .gp-left-submenu { display: none !important; }

    /* Floating tooltip on hover (replaces the hidden label) */
    #gp-page.gp-sidebar-collapsed .gp-left-menu-item { position: relative; }
    #gp-page.gp-sidebar-collapsed .gp-left-menu-link,
    #gp-page.gp-sidebar-collapsed .gp-left-menu-action {
        position: relative;
    }
    #gp-page.gp-sidebar-collapsed .gp-left-menu-link:hover::after,
    #gp-page.gp-sidebar-collapsed .gp-left-menu-action:hover::after {
        content: attr(data-label);
        position: absolute;
        left: calc(100% + 8px);
        top: 50%;
        transform: translateY(-50%);
        background: #0F172A;
        color: #fff;
        padding: 6px 10px;
        border-radius: 8px;
        font-size: 12px;
        font-weight: 500;
        white-space: nowrap;
        z-index: 300;
        box-shadow: 0 8px 24px -8px rgba(15, 23, 42, 0.5),
                    0 0 0 1px rgba(255, 255, 255, 0.05);
        pointer-events: none;
    }

    /* Rotate the toggle icon to show "collapse direction" */
    #gp-page.gp-sidebar-collapsed .gp-mobile-toggle i { transform: rotate(180deg); }
    .gp-mobile-toggle i { transition: transform 0.25s var(--gp-ease); }
}

/* ================================================================
   6. Main content
   ================================================================ */
#gp-page-main {
    padding: 28px !important;
    flex: 1 1 auto;
    box-sizing: border-box;
}

#gp-dashboard-loading {
    color: var(--gp-text-mute) !important;
    padding: 60px !important;
    text-align: center;
    font-size: 14px;
}

/* ================================================================
   7. Cards
   ================================================================ */
.gp-card {
    background: var(--gp-surface);
    border: 1px solid var(--gp-border-soft);
    border-radius: var(--gp-radius);
    box-shadow: var(--gp-shadow-sm);
    overflow: hidden;
    margin-bottom: 24px;
}

.gp-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gp-border-soft);
    background:
        linear-gradient(180deg, #FBFCFE 0%, #FFFFFF 100%);
}

.gp-card-header h2 {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    color: var(--gp-text) !important;
    letter-spacing: -0.01em;
}
.gp-card-header h2 i {
    color: var(--gp-accent);
    font-size: 15px;
}

.gp-card-body {
    padding: 24px;
}

#gp-welcome-text {
    color: var(--gp-text-mute) !important;
    margin-bottom: 24px !important;
    font-size: 14px;
    line-height: 1.55;
}

/* ================================================================
   8. Stat grid (action cards)
   ================================================================ */
.gp-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.gp-stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    background: var(--gp-surface);
    border: 1px solid var(--gp-border-soft);
    border-radius: var(--gp-radius);
    text-decoration: none !important;
    color: var(--gp-text);
    transition: transform 0.2s var(--gp-ease),
                box-shadow 0.25s var(--gp-ease),
                border-color 0.2s var(--gp-ease);
    box-shadow: var(--gp-shadow-xs);
    position: relative;
    overflow: hidden;
}

.gp-stat-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg,
                rgba(99, 102, 241, 0) 0%,
                rgba(99, 102, 241, 0.07) 100%);
    opacity: 0;
    transition: opacity 0.25s var(--gp-ease);
    pointer-events: none;
}

.gp-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--gp-shadow-md);
    border-color: rgba(99, 102, 241, 0.25);
}
.gp-stat-card:hover::after { opacity: 1; }

.gp-stat-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: #fff;
    font-size: 17px;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    box-shadow: 0 8px 18px -8px rgba(99, 102, 241, 0.6),
                inset 0 0 0 1px rgba(255, 255, 255, 0.18);
    flex-shrink: 0;
}

/* Color variants used by dashboard.js */
.gp-stat-icon-teal    { background: linear-gradient(135deg, #14B8A6, #06B6D4); box-shadow: 0 8px 18px -8px rgba(20, 184, 166, 0.55), inset 0 0 0 1px rgba(255,255,255,0.18); }
.gp-stat-icon-indigo  { background: linear-gradient(135deg, #6366F1, #8B5CF6); box-shadow: 0 8px 18px -8px rgba(99, 102, 241, 0.55), inset 0 0 0 1px rgba(255,255,255,0.18); }
.gp-stat-icon-emerald { background: linear-gradient(135deg, #10B981, #22C55E); box-shadow: 0 8px 18px -8px rgba(16, 185, 129, 0.55), inset 0 0 0 1px rgba(255,255,255,0.18); }
.gp-stat-icon-purple  { background: linear-gradient(135deg, #8B5CF6, #D946EF); box-shadow: 0 8px 18px -8px rgba(139, 92, 246, 0.55), inset 0 0 0 1px rgba(255,255,255,0.18); }
.gp-stat-icon-amber   { background: linear-gradient(135deg, #F59E0B, #F97316); box-shadow: 0 8px 18px -8px rgba(245, 158, 11, 0.55), inset 0 0 0 1px rgba(255,255,255,0.18); }

.gp-stat-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.gp-stat-value {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--gp-text);
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gp-stat-label {
    font-size: 12.5px;
    color: var(--gp-text-mute);
    font-weight: 500;
    line-height: 1.4;
}

/* ================================================================
   9. Mobile (≤ 768px)
   ================================================================ */
@media (max-width: 768px) {
    :root { --gp-sidebar-w: 280px; }

    #gp-page {
        flex-direction: column !important;
        min-height: 100vh !important;
    }

    /* Sidebar becomes an overlay drawer */
    #gp-page-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        width: var(--gp-sidebar-w) !important;
        max-width: 86vw !important;
        flex: none !important;
        z-index: 200 !important;
        transform: translateX(-100%);
        transition: transform 0.3s var(--gp-ease);
        box-shadow: 20px 0 40px -20px rgba(15, 23, 42, 0.4);
        order: 1 !important;
        display: flex !important;
    }
    #gp-page-sidebar.active { transform: translateX(0); }

    /* Backdrop overlay */
    #gp-page-sidebar.active::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        backdrop-filter: blur(2px);
        z-index: -1;
        left: var(--gp-sidebar-w);
        animation: gpFadeIn 0.25s var(--gp-ease);
    }

    .gp-left-menu-container {
        max-height: none !important;
        overflow-y: auto !important;
        flex: 1;
    }

    /* Right pane is full width */
    #gp-page-right {
        width: 100% !important;
        order: 2 !important;
        flex: 1 1 auto !important;
    }

    #gp-page-header {
        padding: 0 16px !important;
        height: 60px;
        min-height: 60px;
    }

    .gp-header-left h1 { font-size: 16px !important; }

    /* Hide chips that crowd a small header */
    .gp-header-email,
    .gp-header-role { display: none !important; }

    #gp-page-main { padding: 18px !important; }

    .gp-card-header { padding: 16px 18px; }
    .gp-card-body   { padding: 18px; }

    .gp-stat-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Hamburger */
    .gp-mobile-toggle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        background: var(--gp-surface) !important;
        border: 1px solid var(--gp-border) !important;
        border-radius: 10px !important;
        color: var(--gp-text) !important;
        font-size: 16px !important;
        cursor: pointer !important;
        box-shadow: var(--gp-shadow-xs);
    }
    .gp-mobile-toggle:hover { background: #F8FAFC !important; }

    /* Close X inside the drawer */
    .gp-sidebar-close-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        position: absolute !important;
        top: 16px !important;
        right: 14px !important;
        width: 34px;
        height: 34px;
        background: rgba(255, 255, 255, 0.06) !important;
        color: #fff !important;
        border: 1px solid rgba(255, 255, 255, 0.10) !important;
        border-radius: 999px !important;
        font-size: 13px !important;
        cursor: pointer !important;
        z-index: 10;
    }
    .gp-sidebar-close-btn:hover { background: rgba(255, 255, 255, 0.12) !important; }

    .gp-btn-danger { padding: 7px 12px; font-size: 12.5px; }
}

/* ================================================================
   10. Animations
   ================================================================ */
@keyframes gpFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}