/* ==========================================================================
   GLOBAL STRUCTURE & MATERIAL FLAT THEME WITH THEME VARIABLES
   ========================================================================== */
:root {
    /* DEFAULT LIGHT THEME COLORS */
    --bg-body: #f8f9fa;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f1f3f4;
    --color-primary: #1a73e8;
    --color-primary-light: #e8f0fe;
    --text-main: #202124;
    --text-muted: #5f6368;
    --border-color: #dadce0;
    
    --transition: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    --theme-transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                        color 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                        border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                        background 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    
    --bg-card: #eef0f3;
    --bg-card-hover: #e2e5e9;
}

/* ⚡ MONOCHROMATIC DARK THEME (NO BLUE - PURE WHITE, GRAYS & BLACK) */
[data-theme="dark"] {
    --bg-body: #121214;
    --bg-surface: #18181a;
    --bg-surface-hover: #222226;
    --color-primary: #ffffff;
    --color-primary-light: rgba(255, 255, 255, 0.08);
    --text-main: #f1f3f4;
    --text-muted: #8c8c94;
    --border-color: rgba(255, 255, 255, 0.06);
    
    --bg-card: #202024;
    --bg-card-hover: #28282e;
}

html, body {
    -webkit-user-select: none; user-select: none;
    font-family: 'Google Sans', 'Roboto', sans-serif;
    font-size: 100%;
    line-height: 1.5;
    background: var(--bg-body); color: var(--text-main);
    height: 100vh; margin: 0; padding: 0; 
    overflow: hidden; 
    transition: var(--theme-transition);
}

*, *::before, *::after { 
    box-sizing: border-box !important; 
    -webkit-tap-highlight-color: transparent;
    transition: var(--theme-transition);
}
img { pointer-events: none; }

/* ==========================================================================
   DESKTOP SIDEBAR CONFIG ARCHITECTURE
   ========================================================================== */
.layout { width: 100%; height: 100vh; display: flex; flex-direction: row; overflow: hidden; }

.main-area { 
    flex: 1; 
    overflow-y: auto; 
    overflow-x: hidden; 
    background: var(--bg-body); 
    font-size: 1rem; 
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: padding var(--transition), var(--theme-transition); 
}

.sidebar {
    width: 13.75rem;
    height: 100%; flex-shrink: 0; background: var(--bg-surface);
    padding: 0.75rem 0; 
    display: flex; flex-direction: column; gap: 0.25rem;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width var(--transition), var(--theme-transition);
    will-change: width;
}

.sidebar-brand-area { display: flex; align-items: center; gap: 1rem; padding: 0.0625rem 1.25rem; margin-bottom: 0.4375rem; overflow: hidden; flex-shrink: 0; }
.logo-wrapper { position: relative; width: 1.5rem; height: 1.5rem; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.sidebar-logo-img { width: 1.5rem; height: 1.5rem; object-fit: contain; transition: opacity var(--transition); }

.toggle-sidebar-trigger {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 2rem; height: 2rem; background: var(--bg-surface-hover);
    border: none; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: var(--text-main); cursor: pointer; opacity: 0; transition: opacity var(--transition);
}
.logo-wrapper:hover .sidebar-logo-img { opacity: 0; }
.logo-wrapper:hover .toggle-sidebar-trigger { opacity: 1; }

.sidebar-brand-text { font-size: 1.125rem; font-weight: 500; color: var(--text-main); white-space: nowrap; transition: opacity var(--transition); }

.nav-item {
    display: flex; align-items: center; gap: 1rem; padding: 0 1.25rem; height: 3rem;
    border-radius: 0 1.5rem 1.5rem 0; color: var(--text-muted); font-weight: 500; font-size: 0.9375rem;
    width: calc(100% - 0.75rem); cursor: pointer; overflow: hidden; white-space: nowrap; flex-shrink: 0;
    transition: background var(--transition), color var(--transition), padding var(--transition), border-radius var(--transition), width var(--transition), var(--theme-transition);
}
.nav-item:hover { background: var(--bg-surface-hover); }

/* ⚡ Active Nav Item (Clean Monochrome in Dark Mode) */
.nav-item.active { 
    background: var(--color-primary-light); 
    color: var(--color-primary); 
}

.nav-item .material-symbols-outlined { flex-shrink: 0; width: 1.5rem; text-align: center; }
.nav-item span:not(.material-symbols-outlined) { transition: opacity var(--transition), transform var(--transition); opacity: 1; display: inline-block; }

body.sidebar-closed .sidebar { width: 4.25rem; }
body.sidebar-closed .sidebar-brand-text { opacity: 0; pointer-events: none; }
body.sidebar-closed .sidebar-brand-area { padding: 0.0625rem 1.25rem; }
body.sidebar-closed .nav-item { width: 100% !important; padding: 0 1.25rem; border-radius: 0px !important; }
body.sidebar-closed .nav-item span:not(.material-symbols-outlined) { opacity: 0; transform: translateX(-0.625rem); pointer-events: none; }
body.sidebar-closed .toggle-sidebar-trigger .material-symbols-outlined { transform: rotate(180deg); }

/* ==========================================================================
   MOBILE INTERFACE
   ========================================================================== */
.app-bar { 
    height: 3.75rem; 
    background: var(--bg-surface); 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 0 1rem; 
    border-bottom: 1px solid var(--border-color); 
    flex-shrink: 0; 
    transition: var(--theme-transition); 
}
.brand-text { font-size: 1.125rem; font-weight: 500; }
.mobile-menu-btn { background: none; border: none; width: 2.75rem; height: 2.75rem; display: flex; align-items: center; justify-content: center; color: var(--text-muted); cursor: pointer; }

body.mobile-menu-open::after { content: ""; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.4); z-index: 990; pointer-events: auto; animation: fadeInOverlay 0.25s ease-out forwards; }
@keyframes fadeInOverlay { from { opacity: 0; } to { opacity: 1; } }

.mobile-side-nav {
    display: flex; flex-direction: column; position: fixed; top: 0; left: 0; width: 15rem; height: 100vh; background: var(--bg-surface); z-index: 999; padding: 1rem 0; gap: 0.25rem;
    overflow-y: auto;
    transform: translateX(-100%); transition: transform var(--transition), var(--theme-transition); 
}
.mobile-side-nav.open { transform: translateX(0); }
.m-nav-header { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1.5rem; font-size: 1.125rem; font-weight: 500; border-bottom: 1px solid var(--border-color); margin-bottom: 1rem; flex-shrink: 0; }

.m-nav-tab { 
    display: flex; align-items: center; gap: 1rem; height: 3rem; padding: 0 1.5rem; 
    border-radius: 0 1.5rem 1.5rem 0; font-size: 0.9375rem; font-weight: 500; 
    color: var(--text-muted); width: calc(100% - 0.75rem) !important; cursor: pointer; 
    flex-shrink: 0; transition: background var(--transition), color var(--transition), var(--theme-transition); 
}
.m-nav-tab.active { 
    background: var(--color-primary-light); 
    color: var(--color-primary); 
}

/* ==========================================================================
   SCROLLBAR
   ========================================================================== */
::-webkit-scrollbar { width: 0.5rem; height: 0.5rem; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background-color: var(--border-color); border-radius: 1.25rem; border: 2px solid transparent; background-clip: padding-box; transition: var(--theme-transition); }
::-webkit-scrollbar-thumb:hover { background-color: var(--text-muted); border: 1px solid transparent; }
html { scrollbar-width: thin; scrollbar-color: var(--border-color) transparent; }

@media (min-width: 769px) {
    .mobile-only { display: none !important; }
    .desktop-only { display: flex !important; }
    .main-area { padding: 0rem 0 2rem 0; }
}

@media (max-width: 768px) {
    .desktop-only { display: none !important; }
    .mobile-only { display: flex !important; }
    .layout { flex-direction: column; }
    .app-bar .brand-container { display: flex; align-items: center; gap: 0.625rem; }
    .app-bar .sidebar-logo-img { opacity: 1 !important; display: block !important; width: 1.75rem; height: 1.75rem; }
    .main-area {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        padding: 0px !important; 
        overflow-x: hidden !important; 
        display: block;
    }
}

body, div, p, span, h1, h2, h3, h4, td, th, a, button {
    user-select: none !important;
    -webkit-user-select: none !important;
}

input, textarea {
    user-select: auto !important;
    -webkit-user-select: auto !important;
}

body, div, p, span:not(.material-symbols-outlined), h1, h2, h3, h4, a, li, input, button, textarea, select {
    font-family: 'Google Sans', 'Roboto', sans-serif !important;
}

.material-symbols-outlined {
    font-family: 'Material Symbols Outlined' !important;
}











/* ⚡ ធ្វើឱ្យ Logo ប្រែពណ៌សសុទ្ធដោយស្វ័យប្រវត្តក្នុង Dark Mode (គ្មានការប្រើរូប logo2.png ឡើយ) */
[data-theme="dark"] .sidebar-logo-img,
[data-theme="dark"] .app-bar .sidebar-logo-img {
    filter: brightness(0) invert(1) !important;
}