/* Layout Structure */
.app-container {
  display: flex;
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Sidebar Navigation (Desktop) */
.sidebar {
  width: 250px;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: width var(--transition-normal);
}
.sidebar-header {
  height: 64px;
  padding: 0 var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  font-weight: 700;
  font-size: var(--font-size-lg);
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.sidebar-nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  font-weight: 500;
  text-decoration: none;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}
.nav-item:hover {
  background-color: var(--bg-subtle);
  color: var(--text-main);
  text-decoration: none;
}
.nav-item.active {
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.nav-item .icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  margin-left: 250px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-normal);
  overflow-x: hidden;
}

/* Topbar Header */
.topbar {
  height: 64px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  position: sticky;
  top: 0;
  z-index: 90;
}
.topbar-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.topbar-search input {
  padding-left: 2.5rem;
}
.topbar-search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Page Body */
.page-content {
  flex: 1;
  padding: var(--space-6);
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* Mobile Bottom Tab Bar (MOB-02) */
.bottom-tabs {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
}
.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  gap: 2px;
  flex: 1;
  height: 100%;
  text-decoration: none;
}
.tab-item.active {
  color: var(--primary);
  font-weight: 600;
}
.tab-item .icon {
  width: 22px;
  height: 22px;
}
.tab-item-center {
  background-color: var(--primary);
  color: #ffffff !important;
  border-radius: var(--radius-full);
  width: 52px;
  height: 52px;
  flex: none;
  transform: translateY(-12px);
  box-shadow: var(--shadow-lg);
}

/* Responsive Breakpoints (MOB-01, UI-08, UI-09) */
@media (max-width: 1023px) {
  .sidebar {
    width: 72px;
  }
  .sidebar-header .sidebar-title,
  .nav-item span {
    display: none;
  }
  .nav-item {
    justify-content: center;
    padding: 0.75rem;
  }
  .main-wrapper {
    margin-left: 72px;
  }
}

@media (max-width: 767px) {
  .sidebar {
    display: none;
  }
  .main-wrapper {
    margin-left: 0;
    max-width: 100vw;
    padding-bottom: 72px; /* space for bottom tab bar */
    overflow-x: hidden;
  }
  .topbar {
    height: 54px;
    padding: 0 var(--space-3);
    gap: var(--space-2);
  }
  .topbar-actions {
    gap: 6px;
    margin-left: auto;
  }
  .topbar-new-sale-btn {
    padding: 0;
    width: 34px;
    height: 34px;
    min-height: 34px;
    justify-content: center;
  }
  .page-content {
    padding: var(--space-3);
    max-width: 100vw;
    overflow-x: hidden;
  }
  .bottom-tabs {
    display: flex;
  }
}
