/**
 * SeymourOS Dashboard - Main Styles
 * Consolidated from dashboard-tablet-v11.html inline styles
 */

/* Dashboard container */
.dashboard-container {
  min-height: 100vh;
  position: relative;
}

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
  z-index: 1020;
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
}

.navbar-container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-nav {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: var(--space-3);
}

.navbar-link {
  color: var(--color-text-secondary);
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  transition: all 200ms ease;
}

.navbar-link:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-text);
}

.navbar-link.active {
  color: var(--color-primary);
}

/* Logo animation */
@keyframes logoSlideIn {
  0% {
    opacity: 0;
    transform: translateX(-30px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Logo styles */
.navbar-logo {
  height: 30px;
  width: auto;
  display: block;
  animation: logoSlideIn 0.6s ease-out forwards;
}

/* Initial state - light logo visible, dark hidden */
.navbar-logo-light {
  display: block;
}

.navbar-logo-dark {
  display: none;
}

/* Dark mode logo handling */
.theme-dark .navbar-logo-light {
  display: none !important;
}

.theme-dark .navbar-logo-dark {
  display: block !important;
}

/* Auto theme (system preference) */
@media (prefers-color-scheme: dark) {
  .theme-auto .navbar-logo-light {
    display: none;
  }
  
  .theme-auto .navbar-logo-dark {
    display: block;
  }
}

/* Mobile auto mode fix - when both theme-auto and theme-light are present */
.theme-auto.theme-light .navbar-logo-light {
  display: block !important;
}

.theme-auto.theme-light .navbar-logo-dark {
  display: none !important;
}

/* Main content */
.dashboard-main {
  margin-left: var(--sidebar-width, 260px);
  padding: calc(56px + var(--space-6)) var(--space-6) var(--space-6);
  transition: margin 400ms cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 100vh;
}

/* Dashboard specific styles */
.dashboard-header {
  margin-bottom: var(--space-6);
}

.dashboard-header h1 {
  font-size: var(--text-3xl);
  font-weight: 600;
  margin: 0 0 var(--space-2);
}

.dashboard-subtitle {
  color: var(--color-text-secondary);
  margin: 0;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin: 0 0 var(--space-2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: var(--text-3xl);
  font-weight: 600;
  margin: 0;
  line-height: 1;
}

.stat-change {
  font-size: var(--text-sm);
  font-weight: 500;
  display: inline-block;
  margin-top: var(--space-2);
}

.stat-change.positive { color: var(--color-success); }
.stat-change.negative { color: var(--color-danger); }
.stat-change.neutral { color: var(--color-text-secondary); }

/* Widgets */
.widgets-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-4);
}

.dashboard-widget {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.widget-header {
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.widget-title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0;
}

.widget-body {
  color: var(--color-text-secondary);
}

/* CSS-only animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stat-value {
  animation: fadeInUp 0.5s ease-out both;
}

/* Animation delays for stat cards */
.stat-card:nth-child(1) .stat-value { animation-delay: 0.1s; }
.stat-card:nth-child(2) .stat-value { animation-delay: 0.2s; }
.stat-card:nth-child(3) .stat-value { animation-delay: 0.3s; }
.stat-card:nth-child(4) .stat-value { animation-delay: 0.4s; }

/* ---------- Mobile / narrow-viewport overrides (≤ 768px) ----------
 * Built 2026-05-17 to fix the unusable mobile state: navbar links were
 * stacking vertically at desktop font sizes, and the sidebar was forced
 * open on top of the main content. Strategy: hamburger-driven navbar
 * dropdown + drawer-style sidebar that defaults to collapsed.
 */

/* Hamburger button — injected by dashboard-sidebar.js on every admin page.
 * Hidden by default (desktop); shown only at ≤ 768px below. */
/* ---------- Theme toggle (☀ ◐ ☾) — desktop segmented control ----------
 * Three icon buttons in a pill, active state filled. Injected into the
 * navbar by dashboard-sidebar.js so every admin page gets it for free.
 * On mobile (≤768px) collapses to a single cycling icon button to save
 * space — see the @media block below.
 */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  margin-left: var(--space-3);
  background: var(--color-bg-tertiary, rgba(127, 127, 127, 0.1));
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 2px;
  gap: 0;
}
.theme-toggle button {
  background: transparent;
  border: 0;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 6px 9px;
  border-radius: 999px;
  transition: background-color 180ms ease, color 180ms ease, transform 120ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
}
.theme-toggle button:hover { color: var(--color-text); transform: scale(1.08); }
.theme-toggle button[aria-pressed="true"] {
  background: var(--color-bg);
  color: var(--color-text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* Custom tooltip on hover. Reads its label from data-tip so the JS can
 * use longer descriptions than the per-icon aria-label without crowding
 * screen-reader output. Pure CSS — appears below the pill, fades in,
 * pointer-events: none so it never intercepts clicks. Hover-only;
 * disabled on touch viewports below. */
.theme-toggle { position: relative; }
.theme-toggle button[data-tip] {
  position: relative;
}
.theme-toggle button[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: var(--color-text, #111);
  color: var(--color-bg, #fff);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
  z-index: 1040;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.theme-toggle button[data-tip]::before {
  content: '';
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%) translateY(-2px);
  border: 6px solid transparent;
  border-bottom-color: var(--color-text, #111);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
  z-index: 1040;
}
.theme-toggle button[data-tip]:hover::after,
.theme-toggle button[data-tip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.theme-toggle button[data-tip]:hover::before,
.theme-toggle button[data-tip]:focus-visible::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
/* Smooth color transitions when theme flips, so it doesn't feel like a
 * page flash. Scoped to surfaces that read on every page. */
body, .navbar, .dashboard-sidebar, .dashboard-main, .stat-card, .lluid-panel {
  transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
}

/* Mobile: collapse the segmented control to a single cycling button.
 * Only the active state's icon is visible; clicking cycles
 * light → system → dark → light. The cycling logic lives in
 * dashboard-sidebar.js. */
@media (max-width: 768px) {
  .theme-toggle {
    padding: 0;
    border: 0;
    background: transparent;
    /* Keep the same left gap as the hamburger has, so Unassigned / toggle /
     * hamburger are evenly spaced in the right cluster. */
    margin-left: var(--space-3);
  }
  .theme-toggle button { display: none; padding: 6px 8px; }
  .theme-toggle button[aria-pressed="true"] {
    display: inline-flex;
    background: transparent;
    box-shadow: none;
    border: 1px solid var(--color-border);
  }
  .theme-toggle button[aria-pressed="true"]:hover { background: var(--color-bg-tertiary, rgba(127, 127, 127, 0.1)); }
  /* No hover on touch — tooltips would never appear and just waste paint. */
  .theme-toggle button[data-tip]::before,
  .theme-toggle button[data-tip]::after { display: none; }
}

.navbar-hamburger {
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  cursor: pointer;
  font-size: 0; /* hide the inline text-content; the glyph comes from ::before */
  line-height: 1;
  margin-left: var(--space-3);
  padding: 6px 10px;
}
.navbar-hamburger::before {
  content: '\2630'; /* ☰ TRIGRAM FOR HEAVEN */
  font-size: 1.25rem;
  line-height: 1;
}
body.navbar-nav-open .navbar-hamburger::before {
  content: '\2715'; /* ✕ MULTIPLICATION X */
}
.navbar-hamburger:hover { background: var(--color-bg-tertiary); }

/* The nav list is always a dropdown panel below the admin navbar (70px
 * tall). It's hidden until body.navbar-nav-open is toggled by the
 * hamburger. Same behavior on desktop and mobile — the navbar no longer
 * carries inline text links so the hamburger drawer is the only nav UI. */
.navbar-nav {
  position: fixed;
  top: 70px;
  right: 0;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-top: 0;
  border-bottom-left-radius: var(--radius-md);
  flex-direction: column;
  gap: 0;
  padding: var(--space-2) 0;
  z-index: 1019;
  max-height: calc(100vh - 70px);
  overflow-y: auto;
  display: none;
  min-width: 200px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}
body.navbar-nav-open .navbar-nav { display: flex; }
.navbar-nav .navbar-link,
.navbar-nav .navbar-link-button {
  display: block;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border-radius: 0;
  text-align: left;
  font-size: 1rem;
}
.navbar-nav .navbar-link:hover,
.navbar-nav .navbar-link-button:hover { background: var(--color-bg-tertiary, rgba(127, 127, 127, 0.1)); }

@media (max-width: 768px) {
  /* On narrow screens, drawer spans full width instead of right-anchored. */
  .navbar-nav {
    left: 0;
    right: 0;
    border-left: 0;
    border-right: 0;
    border-bottom-left-radius: 0;
  }

  /* Main content uses the full viewport width — no sidebar reservation. */
  .dashboard-main {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }
}

/* Drawer overlay: dark scrim behind the sidebar when it's open on mobile.
 * Tap the scrim to close (handled in dashboard-sidebar.js). */
.sidebar-mobile-overlay {
  position: fixed;
  inset: 56px 0 0 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 89; /* one less than the sidebar's z-index: 90 */
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease;
}
@media (max-width: 768px) {
  body.sidebar-drawer-open .sidebar-mobile-overlay {
    opacity: 1;
    pointer-events: auto;
  }
  /* Promote sidebar above the navbar dropdown while open so a tap-outside
   * close feels natural. */
  body.sidebar-drawer-open .dashboard-sidebar { z-index: 1030; }
  /* Lock background scroll while either drawer is open. */
  body.sidebar-drawer-open,
  body.navbar-nav-open { overflow: hidden; }
}