/**
 * ESHADE ERP - Custom CSS Styling & Dynamic Theme Engine
 * Multi-Theme & Custom Color Support
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Base Neutral Palette */
    --eshade-black: #09090b;
    --eshade-dark: #121214;
    --eshade-dark-card: #18181b;
    --eshade-border-dark: #27272a;
    --eshade-border-light: #e4e4e7;
    --eshade-gray-100: #f4f4f5;
    --eshade-gray-200: #e4e4e7;
    --eshade-gray-400: #a1a1aa;
    --eshade-gray-600: #71717a;
    --eshade-gray-800: #27272a;
    --eshade-white: #ffffff;
    --sidebar-width: 260px;

    /* Dynamic Theme Variables (Default: Midnight Black) */
    --theme-sidebar-bg: #09090b;
    --theme-sidebar-border: #27272a;
    --theme-sidebar-brand-bg: #ffffff;
    --theme-sidebar-brand-color: #09090b;
    --theme-sidebar-link-text: #d4d4d8;
    --theme-sidebar-link-hover: #27272a;
    --theme-sidebar-active-bg: #ffffff;
    --theme-sidebar-active-color: #09090b;
    --theme-primary-btn: #09090b;
    --theme-primary-btn-hover: #27272a;
    --theme-accent: #09090b;
}

/* ==========================================================================
   THEME PRESETS (Applied via [data-theme="..."] on <html> or <body>)
   ========================================================================== */

/* 1. Midnight Black (Default Luxury Gym) */
[data-theme="midnight"] {
    --theme-sidebar-bg: #09090b;
    --theme-sidebar-border: #27272a;
    --theme-sidebar-brand-bg: #ffffff;
    --theme-sidebar-brand-color: #09090b;
    --theme-sidebar-link-text: #d4d4d8;
    --theme-sidebar-link-hover: #27272a;
    --theme-sidebar-active-bg: #ffffff;
    --theme-sidebar-active-color: #09090b;
    --theme-primary-btn: #09090b;
    --theme-primary-btn-hover: #27272a;
    --theme-accent: #09090b;
}

/* 2. Navy Royal / Ocean Sport */
[data-theme="navy"] {
    --theme-sidebar-bg: #0f172a;
    --theme-sidebar-border: #1e293b;
    --theme-sidebar-brand-bg: #3b82f6;
    --theme-sidebar-brand-color: #ffffff;
    --theme-sidebar-link-text: #cbd5e1;
    --theme-sidebar-link-hover: #1e293b;
    --theme-sidebar-active-bg: #2563eb;
    --theme-sidebar-active-color: #ffffff;
    --theme-primary-btn: #1d4ed8;
    --theme-primary-btn-hover: #1e40af;
    --theme-accent: #2563eb;
}

/* 3. Crimson Titan / Power Gym Red */
[data-theme="crimson"] {
    --theme-sidebar-bg: #18181b;
    --theme-sidebar-border: #27272a;
    --theme-sidebar-brand-bg: #dc2626;
    --theme-sidebar-brand-color: #ffffff;
    --theme-sidebar-link-text: #e4e4e7;
    --theme-sidebar-link-hover: #27272a;
    --theme-sidebar-active-bg: #dc2626;
    --theme-sidebar-active-color: #ffffff;
    --theme-primary-btn: #dc2626;
    --theme-primary-btn-hover: #b91c1c;
    --theme-accent: #dc2626;
}

/* 4. Emerald Athlete / Performance Green */
[data-theme="emerald"] {
    --theme-sidebar-bg: #064e3b;
    --theme-sidebar-border: #065f46;
    --theme-sidebar-brand-bg: #10b981;
    --theme-sidebar-brand-color: #ffffff;
    --theme-sidebar-link-text: #d1fae5;
    --theme-sidebar-link-hover: #047857;
    --theme-sidebar-active-bg: #10b981;
    --theme-sidebar-active-color: #ffffff;
    --theme-primary-btn: #059669;
    --theme-primary-btn-hover: #047857;
    --theme-accent: #059669;
}

/* 5. Royal Purple / Elite Fitness */
[data-theme="purple"] {
    --theme-sidebar-bg: #1e1b4b;
    --theme-sidebar-border: #2e1065;
    --theme-sidebar-brand-bg: #8b5cf6;
    --theme-sidebar-brand-color: #ffffff;
    --theme-sidebar-link-text: #ede9fe;
    --theme-sidebar-link-hover: #312e81;
    --theme-sidebar-active-bg: #7c3aed;
    --theme-sidebar-active-color: #ffffff;
    --theme-primary-btn: #7c3aed;
    --theme-primary-btn-hover: #6d28d9;
    --theme-accent: #7c3aed;
}

/* 6. Slate Minimalist / Modern Corporate */
[data-theme="slate"] {
    --theme-sidebar-bg: #1e293b;
    --theme-sidebar-border: #334155;
    --theme-sidebar-brand-bg: #0ea5e9;
    --theme-sidebar-brand-color: #ffffff;
    --theme-sidebar-link-text: #e2e8f0;
    --theme-sidebar-link-hover: #334155;
    --theme-sidebar-active-bg: #0ea5e9;
    --theme-sidebar-active-color: #ffffff;
    --theme-primary-btn: #0284c7;
    --theme-primary-btn-hover: #0369a1;
    --theme-accent: #0284c7;
}

/* 7. Amber Gold / Luxury Gym Club */
[data-theme="amber"] {
    --theme-sidebar-bg: #1c1917;
    --theme-sidebar-border: #292524;
    --theme-sidebar-brand-bg: #f59e0b;
    --theme-sidebar-brand-color: #000000;
    --theme-sidebar-link-text: #fef3c7;
    --theme-sidebar-link-hover: #292524;
    --theme-sidebar-active-bg: #f59e0b;
    --theme-sidebar-active-color: #000000;
    --theme-primary-btn: #d97706;
    --theme-primary-btn-hover: #b45309;
    --theme-accent: #d97706;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f8fafc;
    color: #0f172a;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
    background: #71717a;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #09090b;
}

/* App Wrapper Layout */
.app-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar Styling (Dynamic) */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--theme-sidebar-bg);
    color: #ffffff;
    flex-shrink: 0;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--theme-sidebar-border);
    z-index: 1040;
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--theme-sidebar-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #ffffff;
}

.sidebar-brand-icon {
    width: 38px;
    height: 38px;
    background: var(--theme-sidebar-brand-bg);
    color: var(--theme-sidebar-brand-color);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 800;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.sidebar-brand-text h5 {
    margin: 0;
    font-weight: 800;
    letter-spacing: 1.5px;
    font-size: 1.05rem;
    color: #ffffff;
}

.sidebar-brand-text span {
    font-size: 0.68rem;
    color: var(--eshade-gray-400);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem;
}

.nav-category {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #94a3b8;
    padding: 0.75rem 0.75rem 0.35rem 0.75rem;
    margin-top: 0.5rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.65rem 0.85rem;
    color: var(--theme-sidebar-link-text);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.86rem;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 2px;
}

.sidebar-link i {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
    color: inherit;
    opacity: 0.8;
    transition: color 0.2s;
}

.sidebar-link:hover {
    color: #ffffff;
    background-color: var(--theme-sidebar-link-hover);
}

.sidebar-link:hover i {
    opacity: 1;
}

.sidebar-link.active {
    color: var(--theme-sidebar-active-color);
    background-color: var(--theme-sidebar-active-bg);
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.sidebar-link.active i {
    color: var(--theme-sidebar-active-color);
    opacity: 1;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--theme-sidebar-border);
    background-color: rgba(0, 0, 0, 0.2);
}

/* Main Content Area */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: #f8fafc;
}

/* Top Navbar */
.app-navbar {
    background-color: #ffffff;
    border-bottom: 1px solid var(--eshade-border-light);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.navbar-user-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0.75rem;
    border-radius: 30px;
    border: 1px solid var(--eshade-border-light);
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s;
}

.navbar-user-btn:hover {
    background: var(--eshade-gray-100);
}

.user-avatar-initials {
    width: 32px;
    height: 32px;
    background: var(--theme-primary-btn);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    transition: background-color 0.2s;
}

/* Content Body */
.app-content {
    flex: 1;
    padding: 1.5rem;
}

/* Card Styling */
.card-eshade {
    background: #ffffff;
    border: 1px solid var(--eshade-border-light);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    margin-bottom: 1.5rem;
    transition: box-shadow 0.2s;
}

.card-eshade:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.card-eshade-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--eshade-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #ffffff;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

.card-eshade-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--eshade-black);
}

.card-eshade-body {
    padding: 1.25rem;
}

/* Dynamic Buttons */
.btn-eshade-dark {
    background-color: var(--theme-primary-btn);
    color: #ffffff;
    border: 1px solid var(--theme-primary-btn);
    font-weight: 600;
    font-size: 0.86rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-eshade-dark:hover, .btn-eshade-dark:focus {
    background-color: var(--theme-primary-btn-hover);
    color: #ffffff;
    border-color: var(--theme-primary-btn-hover);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.btn-eshade-outline {
    background-color: #ffffff;
    color: var(--theme-primary-btn);
    border: 1px solid var(--theme-primary-btn);
    font-weight: 600;
    font-size: 0.86rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-eshade-outline:hover {
    background-color: var(--theme-primary-btn);
    color: #ffffff;
}

/* Table Styling */
.table-eshade {
    width: 100%;
    margin-bottom: 0;
    vertical-align: middle;
}

.table-eshade thead th {
    background-color: var(--eshade-gray-100);
    color: #27272a;
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--eshade-border-light);
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table-eshade tbody td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid #f1f5f9;
}

.table-eshade tbody tr:hover {
    background-color: #f8fafc;
}

/* Form Controls */
.form-control, .form-select {
    border: 1px solid var(--eshade-border-light);
    border-radius: 6px;
    font-size: 0.875rem;
    padding: 0.55rem 0.85rem;
    color: #0f172a;
}

.form-control:focus, .form-select:focus {
    border-color: var(--theme-primary-btn);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.35rem;
}

/* Metric KPI Cards */
.kpi-card {
    background: #ffffff;
    border: 1px solid var(--eshade-border-light);
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.05);
}

.kpi-card-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--eshade-gray-600);
}

.kpi-card-value {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--eshade-black);
    margin: 0.2rem 0;
}

.kpi-card-icon {
    width: 48px;
    height: 48px;
    background: var(--eshade-gray-100);
    color: var(--eshade-black);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

/* Badges */
.badge-status {
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* Theme Picker Palette Swatches */
.theme-swatch {
    cursor: pointer;
    border-radius: 10px;
    border: 2px solid transparent;
    padding: 10px;
    transition: all 0.2s;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.theme-swatch:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.theme-swatch.active {
    border-color: #000000;
    box-shadow: 0 0 0 2px #000000;
}

.theme-preview-box {
    height: 42px;
    border-radius: 6px;
    display: flex;
    overflow: hidden;
}

/* Mobile Responsive */
@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: -260px;
    }
    .app-sidebar.show {
        left: 0;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1030;
    }
    .sidebar-overlay.show {
        display: block;
    }
}
