/* ═══════════════════════════════════════════════════════════════
   VoBot Dashboard — Dedicated layout, sidebar, and content styles
   Separated from the marketing site for a real app-like feel.
   Uses Emil Kowalski's design engineering principles:
   - ease-out for enters, custom cubic-bezier curves
   - subtle scale on :active, never animate from scale(0)
   - transitions < 300ms for UI elements
   ═══════════════════════════════════════════════════════════════ */

/* ── Custom easing tokens (stronger than defaults) ── */
:root {
  --dash-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --dash-ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --dash-sidebar-width: 260px;
  --dash-sidebar-collapsed: 72px;
  --dash-header-height: 56px;
}

/* ── Body reset for dashboard ── */
.dash-body {
  background: var(--vb-bg);
  overflow: hidden;
}

/* ═══════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════ */
.dash-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--dash-sidebar-width);
  background: rgba(10, 10, 22, 0.97);
  border-right: 1px solid var(--vb-glass-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 250ms var(--dash-ease-out);
  overflow: hidden;
}

/* ── Logo area ── */
.dash-sidebar-logo {
  height: var(--dash-header-height);
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--vb-glass-border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  box-sizing: border-box;
}
.dash-logo-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: #fff;
}
.dash-logo-img {
  height: 28px;
  width: auto;
  flex-shrink: 0;
}


/* ── Nav items ── */
.dash-sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.dash-nav-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--vb-text-muted);
  padding: 0.75rem 1.25rem 0.4rem;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 200ms var(--dash-ease-out);
}
.dash-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.25rem;
  color: var(--vb-text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  transition: color 180ms var(--dash-ease-out),
              background 180ms var(--dash-ease-out);
}
.dash-nav-item:hover {
  color: var(--vb-text);
  background: rgba(255, 255, 255, 0.04);
}
.dash-nav-item:active {
  transform: scale(0.98);
}
.dash-nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.14), rgba(118, 75, 162, 0.08));
}
.dash-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.35rem;
  bottom: 0.35rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--vb-gradient-primary);
}
.dash-nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dash-nav-text {
  opacity: 1;
  transition: opacity 200ms var(--dash-ease-out);
}
.dash-nav-divider {
  height: 1px;
  background: var(--vb-glass-border);
  margin: 0.5rem 1.25rem;
}

/* ── Sidebar bottom: sign out + collapse toggle ── */
.dash-sidebar-bottom {
  border-top: 1px solid var(--vb-glass-border);
  padding: 0.5rem 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.dash-signout-btn {
  color: var(--vb-danger) !important;
  font-family: inherit;
}
.dash-signout-btn:hover {
  background: rgba(255, 61, 113, 0.08) !important;
}
.dash-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-left: auto;
  margin-right: 0.5rem;
  margin-bottom: 0.25rem;
  border-radius: var(--vb-radius-sm);
  background: none;
  border: none;
  color: var(--vb-text-muted);
  cursor: pointer;
  transition: color 180ms var(--dash-ease-out),
              background 180ms var(--dash-ease-out);
}
.dash-collapse-btn:hover {
  color: var(--vb-text);
  background: rgba(255, 255, 255, 0.06);
}
.dash-collapse-btn svg {
  width: 16px;
  height: 16px;
  transition: transform 250ms var(--dash-ease-out);
}

/* ═══════════════════════════════════
   COLLAPSED STATE
   ═══════════════════════════════════ */
.dash-sidebar.collapsed {
  width: var(--dash-sidebar-collapsed);
}
.dash-sidebar.collapsed .dash-nav-text,
.dash-sidebar.collapsed .dash-nav-label {
  opacity: 0;
  width: 0;
  overflow: hidden;
  pointer-events: none;
}
.dash-sidebar.collapsed .dash-nav-item {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
  gap: 0;
}
.dash-sidebar.collapsed .dash-collapse-btn svg {
  transform: rotate(180deg);
}
.dash-sidebar.collapsed .dash-sidebar-logo {
  padding: 0;
  justify-content: center;
}
.dash-sidebar.collapsed .dash-logo-link {
  justify-content: center;
}
.dash-sidebar.collapsed .dash-nav-divider {
  margin-left: 0.75rem;
  margin-right: 0.75rem;
}
.dash-sidebar.collapsed .dash-collapse-btn {
  margin-left: auto;
  margin-right: auto;
}

/* Tooltip on collapsed hover */
.dash-sidebar.collapsed .dash-nav-item {
  position: relative;
}
.dash-sidebar.collapsed .dash-nav-item::after {
  content: attr(data-tab);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%) scale(0.96);
  background: var(--vb-bg-secondary);
  border: 1px solid var(--vb-glass-border);
  color: var(--vb-text);
  padding: 0.3rem 0.7rem;
  border-radius: var(--vb-radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  z-index: 200;
  transition: opacity 150ms var(--dash-ease-out),
              transform 150ms var(--dash-ease-out);
}
.dash-sidebar.collapsed .dash-nav-item:hover::after {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}
/* Only show tooltip for items with data-tab */
.dash-sidebar.collapsed .dash-nav-item:not([data-tab])::after {
  display: none;
}

/* ═══════════════════════════════════
   MAIN AREA
   ═══════════════════════════════════ */
.dash-main {
  margin-left: var(--dash-sidebar-width);
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 250ms var(--dash-ease-out);
}
.dash-main.sidebar-collapsed {
  margin-left: var(--dash-sidebar-collapsed);
}

/* ── Dashboard content wrapper (display:flex for the shell) ── */
#dashboard-content {
  display: none; /* JS sets to flex */
}

/* ── Header bar ── */
.dash-header {
  height: var(--dash-header-height);
  border-bottom: 1px solid var(--vb-glass-border);
  background: rgba(6, 6, 15, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
}
.dash-header-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
}
.dash-header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.dash-header-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--vb-radius-sm);
  color: var(--vb-text-muted);
  transition: color 180ms var(--dash-ease-out),
              background 180ms var(--dash-ease-out);
}
.dash-header-icon:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}
.dash-header-icon svg {
  width: 18px;
  height: 18px;
}
.dash-header-icon .badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--vb-gradient-primary);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}


/* ── Mobile toggle (hidden on desktop) ── */
.dash-mobile-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--vb-text);
  padding: 0.25rem;
  cursor: pointer;
}
.dash-mobile-toggle svg {
  width: 22px;
  height: 22px;
}

/* ═══════════════════════════════════
   CONTENT
   ═══════════════════════════════════ */
.dash-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  max-height: calc(100vh - var(--dash-header-height));
}

/* ── Welcome section ── */
.dash-welcome {
  margin-bottom: 1.75rem;
}
.dash-welcome h2 {
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
}
.dash-welcome p {
  font-size: 0.875rem;
  margin-bottom: 0;
}

/* ── Stat cards ── */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.dash-stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--vb-glass);
  border: 1px solid var(--vb-glass-border);
  border-radius: var(--vb-radius-lg);
  transition: border-color 200ms var(--dash-ease-out),
              box-shadow 200ms var(--dash-ease-out);
}
.dash-stat-card:hover {
  border-color: rgba(102, 126, 234, 0.2);
  box-shadow: 0 0 24px rgba(102, 126, 234, 0.08);
}
.dash-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--vb-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dash-stat-icon svg {
  width: 22px;
  height: 22px;
}
.dash-stat-icon.primary {
  background: rgba(102, 126, 234, 0.12);
  color: var(--vb-primary);
}
.dash-stat-icon.success {
  background: rgba(0, 214, 143, 0.12);
  color: var(--vb-success);
}
.dash-stat-icon.warning {
  background: rgba(255, 170, 0, 0.12);
  color: var(--vb-warning);
}
.dash-stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--vb-text-muted);
}
.dash-stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  margin-top: 0.15rem;
}
.dash-stat-value.success { color: var(--vb-success); }
.dash-stat-value.warning { color: var(--vb-warning); }

/* ── Dashboard cards ── */
.dash-card {
  background: var(--vb-glass);
  border: 1px solid var(--vb-glass-border);
  border-radius: var(--vb-radius-lg);
  overflow: hidden;
}
.dash-card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--vb-glass-border);
}
.dash-card-header h4 {
  font-size: 1rem;
  margin: 0;
}
.dash-card-body {
  padding: 1.5rem;
}

/* ── Order rows ── */
.dash-order-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 150ms var(--dash-ease-out);
}
.dash-order-row:last-child {
  border-bottom: none;
}
.dash-order-row:hover {
  background: rgba(255, 255, 255, 0.02);
  margin: 0 -1.5rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}
.dash-order-info {
  flex: 1;
  min-width: 0;
}
.dash-order-id {
  font-weight: 600;
  color: #fff;
  font-size: 0.875rem;
}
.dash-order-items {
  font-size: 0.75rem;
  color: var(--vb-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 0.15rem;
}
.dash-order-meta {
  text-align: right;
  flex-shrink: 0;
  margin-left: 1rem;
}
.dash-order-amount {
  font-weight: 600;
  color: var(--vb-success);
  font-size: 0.875rem;
}

/* ── Empty state ── */
.dash-empty-state {
  text-align: center;
  padding: 2rem 1rem;
}
.dash-empty-state p {
  color: var(--vb-text-muted);
  margin-bottom: 1rem;
}

/* ── Form row (two columns) ── */
.dash-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ── Button active feedback (Emil Kowalski) ── */
.dash-card .btn:active,
.dash-nav-item:active {
  transform: scale(0.97);
}
.btn {
  transition: transform 160ms var(--dash-ease-out),
              box-shadow 200ms var(--dash-ease-out),
              background 200ms var(--dash-ease-out);
}

/* ═══════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════ */

/* Tablet: collapse sidebar by default */
@media (max-width: 1024px) {
  .dash-stats {
    grid-template-columns: 1fr 1fr;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .dash-sidebar {
    transform: translateX(-100%);
    width: var(--dash-sidebar-width);
    transition: transform 280ms var(--dash-ease-out);
    box-shadow: none;
  }
  .dash-sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 16px 0 48px rgba(0, 0, 0, 0.5);
  }
  .dash-sidebar.collapsed {
    width: var(--dash-sidebar-width); /* don't collapse on mobile */
  }
  .dash-sidebar.collapsed .dash-nav-text,
  .dash-sidebar.collapsed .dash-nav-label {
    opacity: 1;
    width: auto;
    overflow: visible;
    pointer-events: auto;
  }
  .dash-sidebar.collapsed .dash-nav-item {
    justify-content: flex-start;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
  .dash-collapse-btn {
    display: none; /* no collapse toggle on mobile, use hamburger */
  }
  .dash-main {
    margin-left: 0 !important;
  }
  .dash-mobile-toggle {
    display: flex;
  }
  .dash-content {
    padding: 1.25rem;
  }
  .dash-stats {
    grid-template-columns: 1fr;
  }
  .dash-form-row {
    grid-template-columns: 1fr;
  }
  .dash-welcome h2 {
    font-size: 1.35rem;
  }

}

/* Mobile overlay when sidebar is open */
@media (max-width: 768px) {
  .dash-sidebar.mobile-open ~ .dash-main::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 49;
  }
}
