/**
 * Enterprise Cafeteria POS System
 * Base CSS - Layout container, typography, scrollbars
 */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

input, textarea, [contenteditable="true"] {
  user-select: text;
  -webkit-user-select: text;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--text-main);
  background-color: var(--bg-desktop);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* Main Application Shell */
#app {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-app);
}

/* App Main Body: Sidebar + Main Stage */
.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Main Stage View Area */
.app-stage {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-app);
}

/* Left Sidebar Navigation */
.app-sidebar {
  width: 110px;
  min-width: 110px;
  background: linear-gradient(180deg, #2b333c 0%, #1f252c 100%);
  display: flex;
  flex-direction: column;
  border-right: 1px solid #14181d;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.05), 2px 0 6px rgba(0, 0, 0, 0.25);
  z-index: var(--z-sticky);
  transition: width 0.2s ease;
}

.app-sidebar.collapsed {
  width: 56px;
  min-width: 56px;
}

.sidebar-header {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-sm);
  border-bottom: 1px solid #161b20;
  background: linear-gradient(180deg, #37424d 0%, #262e36 100%);
  color: #fff;
  font-weight: 700;
  font-size: var(--font-size-sm);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.sidebar-logo-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  letter-spacing: 0.5px;
}

.app-sidebar.collapsed .sidebar-logo-text {
  display: none;
}

.sidebar-toggle-btn {
  background: transparent;
  border: none;
  color: #adb5bd;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-xs) 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 8px 4px;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  color: #ced4da;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  text-align: center;
}

.nav-item-btn:hover {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.03) 100%);
  color: #ffffff;
}

.nav-item-btn.active {
  background: linear-gradient(90deg, rgba(46, 125, 50, 0.45) 0%, rgba(46, 125, 50, 0.12) 100%);
  border-left-color: #4caf50;
  color: #ffffff;
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.2);
}

.nav-item-btn .nav-icon {
  width: 22px;
  height: 22px;
  margin-bottom: 3px;
  fill: currentColor;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.5));
}

.nav-item-btn .nav-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 95px;
}

.app-sidebar.collapsed .nav-item-btn .nav-label {
  display: none;
}

.app-sidebar.collapsed .nav-item-btn {
  padding: 10px 0;
}

.nav-badge {
  position: absolute;
  top: 4px;
  right: 12px;
  background: #e53935;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-pill);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Sidebar Footer */
.sidebar-footer {
  border-top: 1px solid #161b20;
  padding: var(--space-xs);
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #1b2127;
}

/* Custom 2010s Glossy Scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #e2e6eb;
  border: 1px solid #d0d5dc;
  box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #cbd1da 0%, #a8b0be 100%);
  border: 1px solid #8e96a4;
  border-radius: 4px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #b8c0cc 0%, #909aa8 100%);
}

::-webkit-scrollbar-thumb:active {
  background: linear-gradient(180deg, #8893a3 0%, #a2abb9 100%);
}

/* Common Text Utilities */
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.text-muted { color: var(--text-muted); }
.text-success { color: var(--color-primary); }
.text-danger { color: #c62828; }
.text-warning { color: #ef6c00; }
.text-bold { font-weight: 700; }

.d-none { display: none !important; }
.d-flex { display: flex !important; }
.flex-1 { flex: 1 !important; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
