:root {
  --primary-navy: #002B49;
  --primary-navy-dark: #001f35;
  --primary-navy-light: #0d3d63;
  --primary-gold: #C5A059;
  --primary-gold-dark: #A37E3A;
  --accent-gold-light: #F4E8C1;
  --bg-page: #F4F6F9;
  --bg-card: #FFFFFF;
  --text-main: #1E293B;
  --text-muted: #64748B;
  --text-light: #94A3B8;
  --border-color: #E2E8F0;
  --border-subtle: #F1F5F9;
  
  --success: #059669;
  --success-bg: #ECFDF5;
  --success-border: #A7F3D0;
  
  --danger: #DC2626;
  --danger-bg: #FEF2F2;
  --danger-border: #FECACA;
  
  --warning: #D97706;
  --warning-bg: #FFFBEB;
  --warning-border: #FDE68A;
  
  --info: #2563EB;
  --info-bg: #EFF6FF;
  --info-border: #BFDBFE;

  --sidebar-width: 260px;
  --header-height: 70px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-kh: 'Kantumruy Pro', 'Battambang', -apple-system, sans-serif;
  --font-display: 'Cinzel', serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.khmer-font {
  font-family: var(--font-kh);
}

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

/* Top Header */
.top-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--primary-navy);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 31, 53, 0.25);
  border-bottom: 2px solid var(--primary-gold);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-emblem {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FFFFFF;
  padding: 2px;
  box-shadow: 0 0 10px rgba(197, 160, 89, 0.4);
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-titles .org-kh {
  font-family: var(--font-kh);
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-gold);
  line-height: 1.2;
}

.brand-titles .org-en {
  font-size: 11px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.8);
}

.brand-titles .system-name {
  font-size: 13px;
  font-weight: 600;
  color: #FFFFFF;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.lang-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-btn:hover {
  background: var(--primary-gold);
  color: var(--primary-navy);
}

.admin-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background-color 0.2s;
}

.admin-profile:hover {
  background: rgba(255, 255, 255, 0.08);
}

.admin-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-gold);
}

.admin-info {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.admin-name {
  font-size: 13px;
  font-weight: 600;
  color: #FFFFFF;
}

.admin-role {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
}

.hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: #FFFFFF;
  font-size: 24px;
  cursor: pointer;
}

/* Left Sidebar */
.app-sidebar {
  position: fixed;
  top: var(--header-height);
  bottom: 0;
  left: 0;
  width: var(--sidebar-width);
  background: #FFFFFF;
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  z-index: 900;
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sidebar-menu {
  padding: 16px 0;
  list-style: none;
}

.menu-group-title {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: 0.8px;
  padding: 12px 24px 6px 24px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s ease;
  cursor: pointer;
  position: relative;
}

.menu-item:hover {
  color: var(--primary-navy);
  background-color: var(--bg-page);
}

.menu-item.active {
  color: var(--primary-navy);
  background-color: #EBF3F9;
  font-weight: 600;
  border-left: 4px solid var(--primary-navy);
}

.menu-item .menu-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-badge {
  margin-left: auto;
  background: var(--primary-navy);
  color: #FFFFFF;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
}

.menu-badge.warning {
  background: var(--warning);
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-light);
  background: #FAFBFD;
}

/* Main Content Area */
.main-viewport {
  margin-top: var(--header-height);
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 28px 32px;
  min-height: calc(100vh - var(--header-height));
  transition: margin-left 0.3s ease;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-titles h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-navy);
}

.page-titles p {
  font-size: 13px;
  color: var(--text-muted);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* View Sections / Screens */
.view-screen {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

.view-screen.active-screen {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .main-viewport {
    padding: 20px 24px;
  }
}

@media (max-width: 768px) {
  .hamburger-btn {
    display: block;
  }

  .app-sidebar {
    transform: translateX(-100%);
  }

  .app-sidebar.sidebar-open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
  }

  .main-viewport {
    margin-left: 0;
    padding: 16px;
  }

  .brand-titles .org-en {
    display: none;
  }

  .admin-info {
    display: none;
  }
}
