/* =====================================================================
 * Ethical Grow v3.02 - Premium 3D Responsive Theme Engine
 * 5 Presets: Ocean Deep, Cyber Emerald, Royal Purple, Sunset Crimson, Midnight Dark
 * ===================================================================== */

:root {
    --theme-primary: #0284c7;
    --theme-accent: #38bdf8;
    --theme-bg: #0f172a;
    --theme-surface: #1e293b;
    --theme-surface-glass: rgba(30, 41, 59, 0.75);
    --theme-border: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --card-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.05);
    --3d-transform: perspective(1000px) rotateX(1deg) rotateY(-1deg);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

[data-theme="emerald"] {
    --theme-primary: #059669;
    --theme-accent: #34d399;
    --theme-bg: #06281e;
    --theme-surface: #0b3b2c;
    --theme-surface-glass: rgba(11, 59, 44, 0.75);
    --theme-border: #134e4a;
}

[data-theme="purple"] {
    --theme-primary: #7c3aed;
    --theme-accent: #a78bfa;
    --theme-bg: #1e113a;
    --theme-surface: #2e1a53;
    --theme-surface-glass: rgba(46, 26, 83, 0.75);
    --theme-border: #4c1d95;
}

[data-theme="sunset"] {
    --theme-primary: #e11d48;
    --theme-accent: #fb7185;
    --theme-bg: #2b0914;
    --theme-surface: #400f20;
    --theme-surface-glass: rgba(64, 15, 32, 0.75);
    --theme-border: #881337;
}

[data-theme="midnight"] {
    --theme-primary: #475569;
    --theme-accent: #94a3b8;
    --theme-bg: #020617;
    --theme-surface: #0f172a;
    --theme-surface-glass: rgba(15, 23, 42, 0.75);
    --theme-border: #1e293b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--theme-bg);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Sidebar & Navigation */
aside.sidebar {
    width: 270px;
    background: var(--theme-surface);
    border-right: 1px solid var(--theme-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

.sidebar-brand {
    padding: 1.5rem;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--theme-accent);
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--theme-border);
    letter-spacing: 0.5px;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.8rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-menu li a:hover, .sidebar-menu li a.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--theme-accent);
    border-left: 4px solid var(--theme-accent);
    padding-left: calc(1.5rem - 4px);
}

.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid var(--theme-border);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Main Content Area */
main.main-viewport {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

header.navbar-top {
    height: 70px;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--theme-surface-glass);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--theme-border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.4rem;
    cursor: pointer;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Theme Selector */
.theme-picker {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.25);
    padding: 4px 8px;
    border-radius: 20px;
    border: 1px solid var(--theme-border);
}

.theme-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s;
}
.theme-dot:hover { transform: scale(1.2); }
.theme-dot.active { border-color: white; transform: scale(1.1); }

/* Glass Cards & 3D Depth */
.card-glass {
    background: var(--theme-surface-glass);
    backdrop-filter: blur(16px);
    border: 1px solid var(--theme-border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s;
    position: relative;
    overflow: hidden;
}

.card-glass:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px -8px rgba(0, 0, 0, 0.45);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-title { font-size: 0.8rem; text-transform: uppercase; font-weight: 700; color: var(--text-secondary); letter-spacing: 0.5px; }
.kpi-value { font-size: 2.2rem; font-weight: 800; color: var(--theme-accent); margin: 0.5rem 0 0.2rem; }
.kpi-sub { font-size: 0.8rem; color: #64748b; }

/* Tables */
.table-responsive { width: 100%; overflow-x: auto; }
table.modern-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.9rem; }
table.modern-table th { padding: 1rem; background: rgba(0, 0, 0, 0.3); color: var(--text-secondary); font-weight: 700; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.5px; border-bottom: 1px solid var(--theme-border); }
table.modern-table td { padding: 1rem; border-bottom: 1px solid var(--theme-border); }
table.modern-table tr:hover { background: rgba(255, 255, 255, 0.02); }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.badge-active { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-pending { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-role { background: rgba(56, 189, 248, 0.2); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }

/* Buttons & Inputs */
.btn {
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: all 0.2s;
}
.btn-primary { background: var(--theme-primary); color: white; }
.btn-primary:hover { filter: brightness(1.15); box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35); }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: #0f172a; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; border-radius: 6px; }

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--theme-border);
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}
.form-control:focus { outline: none; border-color: var(--theme-accent); }

/* Responsive Drawer */
@media (max-width: 900px) {
    aside.sidebar {
        position: fixed;
        left: -270px;
        top: 0;
        bottom: 0;
    }
    aside.sidebar.open {
        transform: translateX(270px);
    }
    .mobile-toggle { display: block; }
}
