/* ==========================================================================
   IONITY CENTRAL - MAIN DESIGN SYSTEM
   Brand: Ionity Global / Antwerp Designs (Johan Wilhelm van Antwerp)
   Aesthetic: Dark Canvas (#1A1A1A), Pure White Text (#FFFFFF), Electric Blue Accent (#3366FF),
              8-Bit Retro Structural Accents + Modern Glassmorphism.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&family=Press+Start+2P&display=swap');

:root {
  /* Color Tokens */
  --bg-primary: #1A1A1A;
  --bg-surface: #222222;
  --bg-surface-elevated: #2A2A2A;
  --bg-surface-hover: #333333;
  --bg-overlay: rgba(20, 20, 20, 0.85);

  /* Glassmorphism & Cyber Glow Tokens */
  --glass-bg: rgba(34, 34, 34, 0.72);
  --glass-bg-elevated: rgba(42, 42, 42, 0.85);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(51, 102, 255, 0.45);
  --glass-blur: blur(16px);

  --accent-primary: #3366FF;
  --accent-hover: #4D7BFF;
  --accent-glow: rgba(51, 102, 255, 0.45);
  --accent-subtle: rgba(51, 102, 255, 0.14);
  --accent-8bit-gold: #FFA000;
  --accent-8bit-gold-subtle: rgba(255, 160, 0, 0.15);

  --text-main: #FFFFFF;
  --text-muted: #A0A0A0;
  --text-subtle: #707070;
  --text-inverse: #1A1A1A;

  --border-subtle: #333333;
  --border-focus: #3366FF;
  --border-highlight: rgba(255, 255, 255, 0.14);

  /* Status Colors */
  --status-green: #00E676;
  --status-green-bg: rgba(0, 230, 118, 0.15);
  --status-yellow: #FFD600;
  --status-yellow-bg: rgba(255, 214, 0, 0.15);
  --status-red: #FF3D71;
  --status-red-bg: rgba(255, 61, 113, 0.15);
  --status-purple: #9D4EDD;
  --status-purple-bg: rgba(157, 78, 221, 0.15);
  --status-cyan: #00E5FF;
  --status-cyan-bg: rgba(0, 229, 255, 0.15);

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-8bit: 'Press Start 2P', monospace;

  /* Sizing & Radius */
  --sidebar-width: 280px;
  --header-height: 60px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 18px;

  /* Shadows & 8-Bit Pixel Borders */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.8);
  --shadow-accent: 0 0 25px rgba(51, 102, 255, 0.45);
  --shadow-gold: 0 0 25px rgba(255, 160, 0, 0.45);
  --shadow-green: 0 0 25px rgba(0, 230, 118, 0.45);

  --pixel-border: 2px solid #3366FF;
  --pixel-border-gold: 2px solid #FFA000;
  --pixel-border-subtle: 2px solid #333333;
}

/* Reset & Global Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 8-Bit Pixel Accent Utility */
.font-8bit {
  font-family: var(--font-8bit);
  font-size: 10px;
  letter-spacing: 0.5px;
  line-height: 1.4;
}

.pixel-badge {
  font-family: var(--font-8bit);
  font-size: 9px;
  padding: 4px 8px;
  background: var(--accent-subtle);
  border: 1px solid var(--accent-primary);
  color: var(--accent-primary);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
}

.pixel-box {
  border: 2px solid var(--border-subtle);
  box-shadow: 3px 3px 0px rgba(51, 102, 255, 0.2);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

/* App Container Layout */
#app {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
  background: radial-gradient(circle at 80% 10%, rgba(51, 102, 255, 0.06), transparent 40%),
              radial-gradient(circle at 10% 90%, rgba(0, 229, 255, 0.04), transparent 40%),
              var(--bg-primary);
}

/* Sidebar Navigation */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), width 0.25s ease;
  user-select: none;
  flex-shrink: 0;
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-tag {
  font-size: 9px;
  font-family: var(--font-8bit);
  color: var(--accent-primary);
}

.sidebar-collapse-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
}

.sidebar-collapse-btn:hover {
  color: var(--text-main);
  background: var(--bg-surface-elevated);
}

/* Workspace Selector */
.workspace-selector-wrapper {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.workspace-chip {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
}

.workspace-chip:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-subtle);
}

.workspace-chip-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.workspace-avatar {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--accent-primary), #60A5FA);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
}

/* Navigation Links */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-subtle);
  padding: 8px 10px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.nav-item:hover {
  color: var(--text-main);
  background: var(--bg-surface-elevated);
}

.nav-item.active {
  color: var(--text-main);
  background: var(--accent-subtle);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--accent-primary);
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 8px var(--accent-primary);
}

.nav-item-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
}

.nav-item-count {
  margin-left: auto;
  font-size: 11px;
  padding: 2px 6px;
  background: var(--bg-surface-elevated);
  border-radius: 10px;
  color: var(--text-muted);
}

/* Sidebar Footer & Auth Bar */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-profile-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: border-color 0.2s;
}

.user-profile-card:hover {
  border-color: var(--accent-primary);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  overflow: hidden;
  flex-shrink: 0;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-meta {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.auth-provider-badge {
  font-size: 9px;
  padding: 1px 4px;
  background: rgba(51, 102, 255, 0.2);
  color: var(--accent-hover);
  border-radius: 3px;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-primary);
}

/* Top App Header */
.top-header {
  height: var(--header-height);
  padding: 0 24px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  z-index: 90;
  flex-shrink: 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

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

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  padding: 6px;
}

.header-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: color 0.15s ease;
}

.breadcrumb-item:hover {
  color: var(--accent-hover);
  text-shadow: 0 0 10px var(--accent-glow);
}

.breadcrumb-separator {
  color: var(--text-subtle);
  font-size: 11px;
}

.breadcrumb-current {
  color: var(--text-main);
  font-weight: 700;
  letter-spacing: -0.2px;
}

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

/* Live Cloud Sync Status Pill */
.sync-status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: rgba(0, 230, 118, 0.08);
  border: 1px solid rgba(0, 230, 118, 0.25);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--status-green);
  transition: all 0.2s ease;
}

.sync-status-pill:hover {
  background: rgba(0, 230, 118, 0.14);
  box-shadow: 0 0 12px rgba(0, 230, 118, 0.2);
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status-green);
  box-shadow: 0 0 8px var(--status-green);
  animation: radarDot 2s infinite;
}

@keyframes radarDot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 12px var(--status-green); }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* Quick Search / Command Bar */
.search-trigger-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-trigger-btn:hover {
  border-color: var(--accent-primary);
  color: var(--text-main);
  box-shadow: 0 0 16px var(--accent-glow);
  transform: translateY(-1px);
}

.kbd-shortcut {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

/* Action Buttons & Utilities */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--font-sans);
  user-select: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, #3366FF 0%, #254EDB 100%);
  color: #FFFFFF;
  box-shadow: 0 2px 14px var(--accent-glow);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4D7BFF 0%, #3366FF 100%);
  box-shadow: 0 4px 20px rgba(51, 102, 255, 0.6);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  border-color: var(--border-subtle);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-record-quick {
  background: linear-gradient(135deg, rgba(255, 61, 113, 0.15) 0%, rgba(255, 61, 113, 0.25) 100%);
  border: 1px solid rgba(255, 61, 113, 0.4);
  color: #FF7096;
}

.btn-record-quick:hover {
  background: linear-gradient(135deg, rgba(255, 61, 113, 0.3) 0%, rgba(255, 61, 113, 0.45) 100%);
  border-color: #FF3D71;
  color: #FFFFFF;
  box-shadow: 0 0 16px rgba(255, 61, 113, 0.4);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.btn-outline:hover {
  background: var(--accent-subtle);
}

.btn-icon {
  padding: 7px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-icon:hover {
  color: var(--text-main);
  background: var(--bg-surface-elevated);
  border-color: var(--border-subtle);
}

.btn-icon.active {
  color: var(--accent-primary);
  background: var(--accent-subtle);
}

/* Notification Bell Indicator */
.notification-bell-btn {
  position: relative;
}

.notification-badge-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: var(--status-red);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--status-red);
  display: none;
}

.notification-badge-dot.active {
  display: block;
}

/* Viewport Container */
.viewport-container {
  flex: 1;
  overflow-y: auto;
  position: relative;
  height: calc(100vh - var(--header-height));
}

.view-section {
  display: none;
  min-height: 100%;
  padding: 24px 32px;
  animation: fadeIn 0.2s ease-in-out;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive Rules */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

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

  .mobile-menu-btn {
    display: flex;
  }

  .view-section {
    padding: 16px;
  }
}
