/**
 * Gripar Master Design System - v3.6.0 (Margins Restored)
 */

:root {
    --gp-sidebar-w: 260px;
    --gp-header-h: 60px;
    --gp-pad-x: 40px;
    --gp-primary: #4f46e5;
    --gp-sidebar-bg: #1e293b;
    --gp-sidebar-hover: #334155;
    --gp-body-bg: #f1f5f9;
    --gp-border: #e2e8f0;
    --gp-teal: #0d9488;
    --gp-danger: #dc2626;
    --gp-radius: 10px;
    --gp-text-main: #1e293b;
    --gp-text-sub: #64748b;
}

/* 1. LAYOUT WRAPPER */
#gp-page {
    display: flex;
    min-height: 80vh; /* Changed from 100vh to fit within theme footer */
    background: var(--gp-body-bg);
    /* Removed the 100vw hack to respect theme margins */
    width: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--gp-text-main);
    border: 1px solid var(--gp-border); /* Optional: Adds a border around the app area */
    border-radius: var(--gp-radius);
    overflow: hidden; /* Contains the sidebar/content within the rounded corners */
}
#gp-page *, #gp-page *::before, #gp-page *::after { box-sizing: border-box; }

/* 2. SIDEBAR */
#gp-page-sidebar {
    width: var(--gp-sidebar-w);
    min-width: var(--gp-sidebar-w);
    background: var(--gp-sidebar-bg);
    color: #cbd5e1;
    position: relative; /* Changed from sticky to relative for contained layout */
    height: auto;
    min-height: 100%;
    z-index: 90;
}

.gp-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--gp-header-h);
    padding-left: var(--gp-pad-x) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.gp-brand-icon { width: 32px; height: 32px; background: var(--gp-primary); border-radius: 6px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 14px; }
.gp-brand-text { font-size: 16px; font-weight: 700; color: #f1f5f9; }

/* Sidebar Menu */
.gp-left-menu-theme-sidebar .gp-left-menu-link,
.gp-left-menu-theme-sidebar .gp-left-menu-action { padding-left: var(--gp-pad-x) !important; }
.gp-left-menu-theme-sidebar .gp-left-submenu .gp-left-menu-link,
.gp-left-menu-theme-sidebar .gp-left-submenu .gp-left-menu-action { padding-left: calc(var(--gp-pad-x) + 20px) !important; }
.gp-left-menu-theme-sidebar .gp-left-submenu .gp-left-submenu .gp-left-menu-link { padding-left: calc(var(--gp-pad-x) + 40px) !important; }

/* 3. HEADER */
#gp-page-right { flex: 1; display: flex; flex-direction: column; min-width: 0; }

#gp-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--gp-header-h);
    padding: 0 var(--gp-pad-x) !important;
    background: #fff;
    border-bottom: 1px solid var(--gp-border);
    z-index: 100;
}
.gp-header-left h1 { margin: 0; font-size: 20px; font-weight: 700; color: var(--gp-text-main); }
.gp-header-right { display: flex; align-items: center; gap: 12px; white-space: nowrap; }

.gp-header-email { font-size: 13px; font-weight: 500; color: var(--gp-text-sub); }

.gp-header-role {
    background: var(--gp-primary);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
    vertical-align: middle;
}

/* 4. CONTENT */
#gp-page-main { flex: 1; padding: 28px var(--gp-pad-x); }

/* Components */
.gp-card { background: #fff; border: 1px solid var(--gp-border); border-radius: var(--gp-radius); margin-bottom: 24px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); overflow: hidden; }
.gp-card-header { padding: 16px 24px; border-bottom: 1px solid var(--gp-border); background: #f8fafc; }
.gp-card-header h2 { margin: 0; font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.gp-card-body { padding: 24px; }

/* Dashboard Grid */
.gp-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-top: 20px; }
.gp-stat-card { display: flex; align-items: center; gap: 16px; padding: 20px; background: #fff; border: 1px solid var(--gp-border); border-radius: var(--gp-radius); text-decoration: none; transition: all 0.2s ease; }
.gp-stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.05); border-color: var(--gp-primary); }
.gp-stat-icon { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.gp-stat-icon-teal { background: #ccfbf1; color: #0f766e; }
.gp-stat-icon-indigo { background: #e0e7ff; color: #4338ca; }
.gp-stat-icon-amber { background: #fef3c7; color: #b45309; }
.gp-stat-info { display: flex; flex-direction: column; }
.gp-stat-value { font-size: 16px; font-weight: 700; color: var(--gp-text-main); line-height: 1.2; }
.gp-stat-label { font-size: 13px; color: var(--gp-text-sub); margin-top: 4px; }

/* Forms & Buttons */
.gp-form-panel { background: #f8fafc; padding: 24px; border-radius: 8px; border: 1px solid var(--gp-border); margin-bottom: 24px; }
.gp-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.gp-form-group label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--gp-text-sub); }
.gp-form-group input, .gp-form-group select, .gp-form-group textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--gp-border); border-radius: 6px; font-size: 14px; background: #fff; }
.gp-form-group input:focus { outline: 2px solid var(--gp-primary); border-color: transparent; }
.gp-btn-primary { background: var(--gp-teal); color: #fff; border: none; padding: 10px 20px; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.gp-btn-danger { background: var(--gp-danger); color: #fff; border: none; padding: 6px 16px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }

/* Badges */
.gp-badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; vertical-align: middle; }
.gp-badge-active { background: #d1fae5; color: #065f46; }
.gp-badge-inactive { background: #fee2e2; color: #991b1b; }

@media (max-width: 768px) {
    #gp-page { flex-direction: column; width: 100%; border: none; }
    #gp-page-sidebar { width: 100%; min-width: 100%; height: auto; position: static; }
    #gp-page-header { padding: 0 20px !important; }
    #gp-page-main { padding: 20px; }
    .gp-form-grid { grid-template-columns: 1fr; }
}