/* =============================================
   PRIMELUX ERP - Layout (Header, Sidebar, Content)
   ============================================= */

/* --- App Shell --- */
.app { display: none; min-height: 100vh; }
.app.active { display: flex; flex-direction: column; }

/* --- Header --- */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  height: var(--header-h);
  background: #111;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
}

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

.header-left img { height: 32px; }

.header-divider {
  width: 1px;
  height: 24px;
  background: rgba(255,255,255,.15);
}

.header-role {
  font-size: 12px;
  color: var(--pri);
  letter-spacing: 1px;
  font-weight: 500;
}

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

.header-user {
  font-size: 14px;
  color: rgba(255,255,255,.8);
}

.header-icon {
  background: none;
  border: none;
  color: rgba(255,255,255,.5);
  cursor: pointer;
  font-size: 16px;
  padding: 8px;
  border-radius: 8px;
  transition: all .2s;
  position: relative;
}

.header-icon:hover { color: #fff; background: rgba(255,255,255,.08); }

.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--er);
  color: #fff;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.lang-select {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 6px;
  color: rgba(255,255,255,.7);
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  padding: 5px 8px;
  cursor: pointer;
  outline: none;
}

.lang-select option { background: #222; color: #fff; }

.header-logout {
  background: none;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px;
  padding: 8px 16px;
  color: rgba(255,255,255,.6);
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  transition: all .2s;
}

.header-logout:hover {
  border-color: rgba(255,255,255,.3);
  color: #fff;
  background: rgba(255,255,255,.05);
}

/* Hamburger button (mobile) */
.hamburger {
  display: none;
  background: none;
  border: none;
  color: rgba(255,255,255,.7);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

/* --- Sidebar (Admin) --- */
.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--sf);
  border-right: 1px solid var(--bd);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 35;
  transition: width .25s ease, transform .25s ease;
  display: flex;
  flex-direction: column;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 0;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  color: var(--tx2);
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: 'Outfit', sans-serif;
  white-space: nowrap;
  position: relative;
}

.sidebar-item:hover {
  background: var(--pri-a);
  color: var(--tx);
}

.sidebar-item.on {
  background: var(--pri-a2);
  color: var(--pri-d);
  font-weight: 500;
}

.sidebar-item.on::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--pri);
  border-radius: 0 3px 3px 0;
}

.sidebar-item i {
  width: 20px;
  font-size: 14px;
  text-align: center;
  flex-shrink: 0;
  color: var(--mu);
}

.sidebar-item.on i { color: var(--pri); }

.sidebar-divider {
  height: 1px;
  background: var(--bd);
  margin: 8px 14px;
}

.sidebar-section-label {
  font-size: 10px;
  color: var(--mu);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 12px 18px 4px;
  font-weight: 400;
}

/* Sidebar collapsed */
.sidebar.collapsed {
  width: var(--sidebar-w-collapsed);
}

.sidebar.collapsed .sidebar-item span,
.sidebar.collapsed .sidebar-section-label {
  display: none;
}

.sidebar.collapsed .sidebar-item {
  justify-content: center;
  padding: 12px;
}

.sidebar.collapsed .sidebar-item i {
  margin: 0;
  font-size: 16px;
}

/* Sidebar toggle button */
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border-top: 1px solid var(--bd);
  cursor: pointer;
  color: var(--mu);
  font-size: 14px;
  background: none;
  border-left: none;
  border-right: none;
  border-bottom: none;
  width: 100%;
  transition: color .2s;
}

.sidebar-toggle:hover { color: var(--tx); }

/* --- Main Content (with sidebar offset) --- */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  transition: margin-left .25s ease;
  min-height: calc(100vh - var(--header-h));
}

.main-content.sidebar-collapsed {
  margin-left: var(--sidebar-w-collapsed);
}

/* No sidebar for chauffeur/b2b */
.main-content.no-sidebar {
  margin-left: 0;
}

/* Content area */
.content {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.page { display: none; animation: fadeUp .4s ease; }
.page.on { display: block; }

/* --- Tabs (Chauffeur bottom tabs) --- */
.tabs {
  display: flex;
  background: var(--sf);
  border-bottom: 1px solid var(--bd);
  overflow-x: auto;
  position: sticky;
  top: var(--header-h);
  z-index: 30;
}

.tab {
  padding: 14px 24px;
  font-size: 13px;
  color: var(--mu);
  cursor: pointer;
  border: none;
  background: none;
  font-family: 'Outfit', sans-serif;
  position: relative;
  transition: all .2s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tab:hover { color: var(--tx2); background: var(--sf2); }
.tab.on { color: var(--pri); font-weight: 500; }

.tab.on::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  background: var(--pri);
  border-radius: 2px 2px 0 0;
}

.tab i { font-size: 14px; }

/* Notification Panel */
.notif-panel {
  position: fixed;
  top: var(--header-h);
  right: 20px;
  width: 340px;
  max-height: 400px;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: var(--r);
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
  z-index: 45;
  overflow: hidden;
  animation: fadeUp .2s ease;
}

.notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--bd);
  font-size: 13px;
  font-weight: 500;
}

.btn-link {
  background: none;
  border: none;
  color: var(--pri);
  font-size: 12px;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
}

.notif-list {
  max-height: 340px;
  overflow-y: auto;
}

.notif-item {
  padding: 12px 18px;
  border-bottom: 1px solid var(--bg2);
  font-size: 13px;
  color: var(--tx2);
  cursor: pointer;
  transition: background .2s;
}

.notif-item:hover { background: var(--pri-a); }
.notif-item .notif-time { font-size: 11px; color: var(--mu); margin-top: 4px; }

.empty-sm {
  text-align: center;
  padding: 24px;
  color: var(--mu);
  font-size: 13px;
}

/* --- Responsive --- */

@media (max-width: 768px) {
  .header { padding: 0 12px; }
  .header img { height: 26px; }
  .header-user { display: none; }
  .logout-text { display: none; }
  .hamburger { display: block; }

  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w);
    z-index: 50;
    box-shadow: 4px 0 24px rgba(0,0,0,.15);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,.3);
    z-index: 49;
  }

  .sidebar-overlay.open { display: block; }

  .main-content,
  .main-content.sidebar-collapsed {
    margin-left: 0;
  }

  .content { padding: 16px; }
  .notif-panel { right: 10px; left: 10px; width: auto; }
}

@media (max-width: 480px) {
  .tab { padding: 12px 14px; font-size: 11px; }
  .tab i { display: none; }
  .lang-select { display: none; }
}
