/* ==========================================================================
   Layout Styles (Sidebar, Header, Main Content Area)
   ========================================================================== */

#app {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-page);
  position: relative;
}

/* Sidebar */
.app-sidebar {
  width: 240px;
  background-color: var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  z-index: var(--z-sidebar);
  transition: transform var(--trans-base);
}

.sidebar-header {
  padding: var(--space-6) var(--space-5) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: transparent;
}

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

.sidebar-brand-name {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-white);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.sidebar-brand-sub {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-sidebar-heading);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-section-title {
  padding: var(--space-4) var(--space-5) var(--space-2);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-sidebar-heading);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 var(--space-3) var(--space-6);
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-4);
  color: var(--text-sidebar);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  transition: background-color var(--trans-fast), color var(--trans-fast);
  position: relative;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item:hover {
  background-color: var(--bg-sidebar-hover);
  color: var(--text-white);
}

.nav-item.active {
  background-color: var(--bg-sidebar-active);
  color: var(--text-white);
  font-weight: 600;
}

.nav-item.active svg {
  opacity: 1;
}

.nav-badge {
  margin-left: auto;
  background-color: #29364a;
  color: #a0aec0;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  min-width: 20px;
  text-align: center;
}

.nav-item.active .nav-badge {
  background-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Main Area */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

/* Topbar Header */
.app-header {
  height: 70px;
  background-color: var(--bg-page);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-8);
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  border-bottom: 1px solid var(--border-light);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.btn-sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  transition: background-color var(--trans-fast);
}

.btn-sidebar-toggle:hover {
  background-color: var(--border-light);
}

.page-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.header-center {
  flex: 1;
  max-width: 460px;
  margin: 0 var(--space-6);
}

.search-box {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  width: 100%;
  transition: border-color var(--trans-fast);
}

.search-box:focus-within {
  border-color: var(--border-dark);
}

.search-box svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  font-size: 13.5px;
  color: var(--text-primary);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  position: relative;
  transition: background-color var(--trans-fast);
  border: 1px solid transparent;
}

.icon-btn:hover {
  background-color: var(--bg-card);
  border-color: var(--border-light);
}

.icon-badge-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: var(--radius-pill);
  background-color: var(--primary-orange);
  border: 1.5px solid var(--bg-page);
}

.store-profile-pill {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 4px 10px 4px 6px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color var(--trans-fast);
}

.store-profile-pill:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

.store-profile-info {
  text-align: right;
  line-height: 1.2;
}

.store-profile-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.store-profile-branch {
  font-size: 11px;
  color: var(--text-muted);
}

.store-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  background-color: var(--accent-cyan);
  color: var(--accent-cyan-dark);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Page Content Container */
.page-container {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-8);
  flex: 1;
}

/* Responsive */
@media (max-width: 1024px) {
  .app-sidebar {
    position: fixed;
    transform: translateX(-100%);
  }
  .app-sidebar.open {
    transform: translateX(0);
    box-shadow: 20px 0 30px rgba(0,0,0,0.15);
  }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: calc(var(--z-sidebar) - 1);
  }
  .sidebar-backdrop.active {
    display: block;
  }
  .page-container {
    padding: var(--space-5);
  }
}

@media (max-width: 768px) {
  .header-center {
    display: none;
  }
  .store-profile-info {
    display: none;
  }
}
