/**
 * Bostam SMM Platform — Shared Customer Navigation Stylesheet (Mobile-First)
 * 
 * Rules & Invariants:
 * - Base styles target mobile viewports (320px – 480px)
 * - Mobile (<1024px): Compact topbar + slide-out drawer sidebar
 * - Desktop (>=1024px): Persistent sticky left sidebar + 2-column layout
 * - Brand Colors: Deep Forest Green (#0D3B2E, #0A2920), Warm Orange (#E8590C), Cream surface (#FAF8F5, #FFFFFF)
 * - Zero em dashes in CSS or labels
 * - Completely deprecates and replaces mobile bottom navigation
 */

/* ==========================================================================
   1. Customer Layout Shell
   ========================================================================== */
.dashboard-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--color-bg, #FAF8F5);
  position: relative;
  padding-top: 0 !important;
}

.dashboard-app {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

/* ==========================================================================
   2. Left Sidebar Navigation (Mobile Drawer Baseline: 320px - 1023px)
   ========================================================================== */
.dashboard-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background-color: var(--color-brand-green-dark, #0A2920);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
}

.dashboard-sidebar.is-open {
  transform: translateX(0);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 41, 32, 0.65);
  backdrop-filter: blur(3px);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sidebar-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

/* Sidebar Brand Header */
.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #FFFFFF;
}

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #FFFFFF;
}

.sidebar-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md, 8px);
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #FFFFFF;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sidebar-close-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* Sidebar Navigation Items */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1.25rem 0.875rem;
  flex: 1;
}

.dashboard-sidebar .sidebar-nav-item {
  display: flex !important;
  align-items: center !important;
  gap: 0.875rem !important;
  padding: 0.75rem 1rem !important;
  border-radius: 12px !important;
  color: #DDF0E6 !important;
  text-decoration: none !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  font-size: 0.9375rem !important;
  font-weight: 500 !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  position: relative !important;
}

.dashboard-sidebar .sidebar-nav-item:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #FFFFFF !important;
  transform: translateX(4px);
}

.dashboard-sidebar .sidebar-nav-item.active {
  background: rgba(255, 255, 255, 0.15) !important;
  color: #FFFFFF !important;
  font-weight: 600 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2) !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
}

.dashboard-sidebar .sidebar-nav-item .sidebar-nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke: currentColor;
}

.dashboard-sidebar .nav-badge {
  margin-left: auto;
  background-color: var(--color-accent-orange, #E8590C);
  color: #FFFFFF;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  line-height: 1.2;
}

/* Sidebar Footer (Logout Action) */
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(220, 38, 38, 0.25);
  color: #FCA5A5;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar-logout-btn:hover {
  background: rgba(220, 38, 38, 0.22);
  color: #FFFFFF;
  border-color: rgba(220, 38, 38, 0.4);
}

.sidebar-logout-btn:disabled,
.dropdown-logout-btn:disabled,
.logout-btn:disabled,
.logout-trigger:disabled,
.is-signing-out {
  opacity: 0.7 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.logout-spinner {
  display: inline-block;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ==========================================================================
   3. Top Navigation Bar (Mobile-First Header)
   ========================================================================== */
.site-header,
.dashboard-topbar,
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 64px;
  min-height: 56px;
  padding: 0 1rem;
  background-color: #FFFFFF;
  border-bottom: 1px solid var(--color-border, #E5DFD5);
  position: sticky;
  top: 0;
  z-index: 100;
  box-sizing: border-box;
}

body.dashboard-page .site-header,
.dashboard-app > .site-header,
.dashboard-layout .site-header {
  position: sticky !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  margin: 0 !important;
  padding-top: 0 !important;
  border-radius: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  box-shadow: none !important;
  pointer-events: auto !important;
}

@media (min-width: 480px) {
  body.dashboard-page .site-header,
  .dashboard-app > .site-header,
  .dashboard-layout .site-header {
    top: 0 !important;
    padding-top: 0 !important;
  }
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 0 0 auto;
}

.mobile-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--color-surface-subtle, #F5F2EB);
  border: 1px solid var(--color-border, #E5DFD5);
  color: var(--color-brand-green, #0D3B2E);
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
  transition: all 0.15s ease;
}

.mobile-menu-toggle:hover {
  background: var(--color-surface-hover, #EBE6DA);
}

.site-header .brand-logo,
.dashboard-topbar .brand-logo,
.top-bar .brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-brand-green, #0D3B2E);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
  margin: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  flex-shrink: 0;
}

.topbar-right .btn,
.topbar-right .btn-primary {
  white-space: nowrap;
  flex-shrink: 0;
  margin: 0;
}

/* ==========================================================================
   4. Desktop Layout Enhancements (>=1024px)
   ========================================================================== */
@media (min-width: 1024px) {
  .dashboard-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
  }

  .dashboard-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    transform: none !important;
    box-shadow: none;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
  }

  .sidebar-close-btn {
    display: none !important;
  }

  .sidebar-backdrop {
    display: none !important;
  }

  .mobile-menu-toggle {
    display: none !important;
  }

  .site-header .brand-logo,
  .dashboard-topbar .brand-logo,
  .top-bar .brand-logo {
    display: none !important;
  }

  .site-header,
  .dashboard-topbar,
  .top-bar {
    padding: 0 2rem;
  }
}

@media (min-width: 1440px) {
  .dashboard-layout {
    grid-template-columns: 280px 1fr;
  }
}
