/* ==========================================================================
   ECS-INVENTORY Modern Dashboard Design System
   Enterprise-grade, responsive, accessible, dark/light harmonious styling.
   ========================================================================== */

:root {
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bg-main: #0b0f19;
  --bg-sidebar: #0f172a;
  --bg-surface: #1e293b;
  --bg-surface-hover: #334155;
  --border-color: #1e293b;
  --border-subtle: rgba(255, 255, 255, 0.08);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-primary: #3b82f6;
  --accent-primary-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.25);

  --badge-blue: #3b82f6;
  --badge-amber: #f59e0b;
  --badge-emerald: #10b981;
  --badge-rose: #ef4444;

  --topbar-height: 64px;
  --sidebar-width: 310px;
  --sidebar-collapsed-width: 0px;
  --transition-speed: 0.25s;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Dashboard Layout Structure
   ========================================================================== */

.dashboard-wrapper {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Top Navigation Bar */
.dashboard-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-height);
  background: linear-gradient(180deg, #131d31 0%, #0f172a 100%);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 20px;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

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

.sidebar-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-speed) ease;
}

.sidebar-toggle-btn:hover {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-logo-img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: contain;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-left: 2px;
}

.topbar-center {
  display: flex;
  align-items: center;
  gap: 20px;
}

.live-clock-widget {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.live-clock-widget .clock-icon {
  color: var(--accent-primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.role-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.role-tag.admin {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.role-tag.sales {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.role-tag.ssales {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.role-tag.warehouse {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.user-profile-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-subtle);
  padding: 4px 12px 4px 6px;
  border-radius: 30px;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #ffffff;
  text-transform: uppercase;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  border: 1px solid transparent;
}

.action-btn.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.action-btn.btn-outline:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.action-btn.btn-logout {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.25);
}

.action-btn.btn-logout:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}

/* ==========================================================================
   Main Body (Sidebar + Content Workspace)
   ========================================================================== */

.dashboard-body {
  display: flex;
  flex: 1;
  height: calc(100vh - var(--topbar-height));
  position: relative;
  overflow: hidden;
}

/* Sidebar Container */
.dashboard-sidebar-container {
  width: var(--sidebar-width);
  height: 100%;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  transition: width var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  position: relative;
  z-index: 50;
}

.dashboard-sidebar-container.collapsed {
  width: 0;
  border-right-color: transparent;
}

.sidebar-iframe {
  width: var(--sidebar-width);
  height: 100%;
  border: none;
  background-color: var(--bg-sidebar);
}

/* Content Container */
.dashboard-content-container {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: #0b0f19;
  position: relative;
  overflow: hidden;
}

.content-toolbar {
  height: 38px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.content-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.breadcrumb-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-weight: 500;
}

.breadcrumb-indicator svg {
  width: 14px;
  height: 14px;
}

.content-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  transition: all 0.2s ease;
}

.toolbar-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.workspace-iframe {
  flex: 1;
  width: 100%;
  height: calc(100% - 38px);
  border: none;
  background-color: #ffffff;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */

@media (max-width: 900px) {
  :root {
    --sidebar-width: 270px;
  }
  .live-clock-widget {
    display: none;
  }
  .brand-sub {
    display: none;
  }
}
