/* 🎨 Haiven Design System - Apple-Quality UI */

/* Import unified design system (single source of truth) */
@import './design-system.css';

/* ============================================
   RESET & BASE
   ============================================ */

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

/* Premium selection styling */
::selection {
  background: var(--haiven-cyan-alpha-30);
  color: var(--color-text-primary);
}

::-moz-selection {
  background: var(--haiven-cyan-alpha-30);
  color: var(--color-text-primary);
}

/* Note: All color tokens now come from design-system.css */

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: rgba(59, 157, 255, 0.3);
  border-radius: 6px;
  border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 157, 255, 0.5);
}

::-webkit-scrollbar-corner {
  background: var(--bg-primary);
}

body {
  font-family:
    'Inter',
    -apple-system,
    BlinkMacSystemFont,
    'SF Pro Display',
    'Segoe UI',
    system-ui,
    sans-serif;
  background: linear-gradient(180deg, var(--black) 0%, var(--deep-black) 100%);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Gradient Mesh Background - Haiven brand colors */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.4;
  background:
    radial-gradient(circle at 20% 50%, rgba(59, 157, 255, 0.15), transparent 50%),
    radial-gradient(circle at 80% 50%, rgba(0, 217, 197, 0.15), transparent 50%);
  pointer-events: none;
  animation: backgroundPulse 15s ease-in-out infinite;
}

/* Z-Index Scale - Consistent stacking context
   0-9: Background elements
   10-99: Base content
   100-199: Fixed UI (navbar, bottom nav)
   200-299: Overlays (dropdowns, tooltips)
   300-399: Modals and sheets
   400-499: Toasts and notifications
*/

@keyframes backgroundPulse {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 0.5;
  }
}

/* ============================================
   NAVIGATION
   ============================================ */

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  height: 64px;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 48px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-decoration: none;
  transition: opacity var(--timing-fast);
  cursor: pointer;
}

.logo:hover {
  opacity: 0.8;
}

.logo-icon {
  width: 32px;
  height: 32px;
  position: relative;
  filter: drop-shadow(0 0 16px rgba(59, 157, 255, 0.7));
  animation: logoGlow 3s ease-in-out infinite;
}

@keyframes logoGlow {
  0%,
  100% {
    filter: drop-shadow(0 0 16px rgba(59, 157, 255, 0.7));
  }
  50% {
    filter: drop-shadow(0 0 24px rgba(0, 217, 197, 0.8));
  }
}

.logo-h {
  width: 100%;
  height: 100%;
  position: relative;
}

.h-node {
  position: absolute;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.h-node-tl {
  left: 5px;
  top: 2px;
  width: 10px;
  height: 10px;
  background: radial-gradient(circle, var(--primary-blue), var(--primary-cyan));
  box-shadow: 0 0 8px var(--primary-blue);
}

.h-node-tr {
  right: 5px;
  top: 2px;
  width: 10px;
  height: 10px;
  background: radial-gradient(circle, var(--primary-cyan), var(--primary-blue));
  box-shadow: 0 0 8px var(--primary-cyan);
}

.h-node-bl {
  left: 5px;
  bottom: 2px;
  width: 10px;
  height: 10px;
  background: radial-gradient(circle, var(--primary-cyan), var(--primary-blue));
  box-shadow: 0 0 8px var(--primary-cyan);
}

.h-node-br {
  right: 5px;
  bottom: 2px;
  width: 10px;
  height: 10px;
  background: radial-gradient(circle, var(--primary-blue), var(--primary-cyan));
  box-shadow: 0 0 8px var(--primary-blue);
}

.h-stem-left,
.h-stem-right {
  position: absolute;
  width: 4px;
  top: 12px;
  bottom: 12px;
  background: linear-gradient(180deg, var(--primary-blue), var(--primary-cyan));
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(59, 157, 255, 0.5);
}

.h-stem-left {
  left: 8px;
}
.h-stem-right {
  right: 8px;
}

.h-connector {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  height: 5px;
  background: linear-gradient(
    90deg,
    var(--primary-blue) 0%,
    var(--primary-cyan) 50%,
    var(--primary-blue) 100%
  );
  border-radius: 2.5px;
  box-shadow: 0 0 12px rgba(59, 157, 255, 0.6);
}

.logo-text .highlight {
  background: linear-gradient(135deg, var(--primary-blue), var(--primary-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

.nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
  justify-content: center;
}

.nav-item {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: all var(--timing-base) cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.nav-item svg,
.nav-item .icon {
  margin-left: 6px;
  flex-shrink: 0;
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(31, 182, 255, 0.08);
  transform: translateY(-1px);
}

.nav-item.active {
  color: var(--text-primary);
  background: linear-gradient(135deg, rgba(31, 182, 255, 0.15), rgba(78, 205, 196, 0.15));
  box-shadow:
    0 0 24px rgba(31, 182, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(31, 182, 255, 0.2);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: -13px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--primary-blue);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--primary-blue);
}

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

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 20px;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.icon-button:hover {
  background: linear-gradient(135deg, rgba(31, 182, 255, 0.15), rgba(31, 182, 255, 0.08));
  color: rgba(31, 182, 255, 1);
  border-color: rgba(31, 182, 255, 0.4);
  transform: translateY(-1px) scale(1.02);
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.15),
    0 0 16px rgba(31, 182, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.icon-button:active {
  transform: translateY(0) scale(0.98);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.15),
    inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.user-menu {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--timing-base);
}

.user-menu:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-medium);
  box-shadow: var(--shadow-sm);
}

.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  padding: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 200;
}

.user-dropdown.show {
  display: block;
}

.user-info {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 4px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-blue), var(--primary-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  box-shadow:
    0 0 0 2px rgba(59, 157, 255, 0.3),
    0 4px 8px rgba(0, 0, 0, 0.2);
}

.user-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ============================================
   CARDS
   ============================================ */

.card {
  background: linear-gradient(135deg, rgba(28, 28, 30, 0.95), rgba(44, 44, 46, 0.9));
  border: 1px solid rgba(31, 182, 255, 0.2);
  border-radius: 16px;
  padding: 24px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
}

.card:hover {
  border-color: rgba(31, 182, 255, 0.4);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(31, 182, 255, 0.3),
    0 0 30px rgba(31, 182, 255, 0.2);
  transform: translateY(-4px);
}

.card-interactive {
  cursor: pointer;
}

.card-interactive:hover {
  border-color: rgba(31, 182, 255, 0.6);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(31, 182, 255, 0.5),
    0 0 40px rgba(31, 182, 255, 0.3);
  transform: translateY(-6px);
}

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

.card-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: rgba(255, 255, 255, 0.95);
}

/* ============================================
   STATS GRID
   ============================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
}

.stat-card {
  background: linear-gradient(135deg, rgba(28, 28, 30, 0.95), rgba(44, 44, 46, 0.9));
  border: 1px solid rgba(31, 182, 255, 0.2);
  border-radius: 16px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--stat-color, var(--primary-blue));
  opacity: 0.7;
  transition: opacity var(--timing-fast);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, var(--stat-color, var(--primary-blue)) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--timing-base);
  pointer-events: none;
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card:hover::after {
  opacity: 0.05;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(31, 182, 255, 0.3),
    0 0 30px rgba(31, 182, 255, 0.2);
  border-color: rgba(31, 182, 255, 0.4);
}

.stat-icon {
  font-size: 32px;
  margin-bottom: var(--space-md);
  opacity: 0.8;
}

.stat-value {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: 8px;
  line-height: 1;
}

.stat-label {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.stat-change {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

/* Insight Cards (Memory Insights Panel) */
.insight-value {
  font-size: 36px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1;
  margin-bottom: 8px;
}

.insight-label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
  letter-spacing: 0.01em;
  margin-bottom: 4px;
}

.insight-trend {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
}

.stat-card.hot {
  --stat-color: var(--hot-red);
}
.stat-card.warm {
  --stat-color: var(--warm-amber);
}
.stat-card.cold {
  --stat-color: var(--cold-cyan);
}

/* ============================================
   MEMORY ITEMS
   ============================================ */

.memory-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.memory-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--tier-color, var(--border-subtle));
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  transition: all var(--timing-base);
  cursor: pointer;
}

.memory-item:hover {
  border-color: var(--tier-color, var(--border-medium));
  box-shadow: var(--shadow-md);
  transform: translateX(4px);
  background: rgba(255, 255, 255, 0.02);
}

.memory-content {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

.memory-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: 13px;
  color: var(--text-tertiary);
  flex-wrap: wrap;
}

.memory-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 6px 12px;
  background: rgba(59, 157, 255, 0.12);
  border: 1px solid rgba(59, 157, 255, 0.25);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.memory-item.hot {
  --tier-color: var(--hot-red);
}
.memory-item.warm {
  --tier-color: var(--warm-amber);
}
.memory-item.cold {
  --tier-color: var(--cold-cyan);
}

/* Modern Memory Cards */
.memory-card-modern {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: default;
}

.memory-card-modern:hover {
  border-color: var(--border-medium);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.memory-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.memory-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.memory-icon {
  font-size: 20px;
}

.memory-category {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.memory-card-badges {
  display: flex;
  align-items: center;
  gap: 8px;
}

.memory-badge-pill {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(147, 197, 253, 0.15);
  color: var(--electric-blue);
}

.memory-badge-pill.hot {
  background: rgba(239, 68, 68, 0.15);
  color: var(--hot-red);
}

.memory-badge-pill.warm {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warm-amber);
}

.memory-badge-pill.cold {
  background: rgba(96, 165, 250, 0.15);
  color: var(--cold-cyan);
}

.memory-importance-badge {
  font-size: 14px;
  line-height: 1;
}

.memory-card-content {
  margin-bottom: 16px;
}

.memory-text {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  margin: 0;
}

.memory-text-full {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  margin: 0;
}

.memory-expand-btn {
  margin-top: 12px;
  padding: 8px 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(31, 182, 255, 0.25);
  border-radius: 8px;
  color: rgba(31, 182, 255, 0.9);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.memory-expand-btn:hover {
  background: linear-gradient(135deg, rgba(31, 182, 255, 0.12), rgba(31, 182, 255, 0.08));
  border-color: rgba(31, 182, 255, 0.5);
  color: rgba(31, 182, 255, 1);
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.15),
    0 0 16px rgba(31, 182, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.memory-expand-btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.15),
    inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.expand-icon {
  font-size: 12px;
  transition: transform 0.2s;
}

.memory-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.memory-tag {
  padding: 4px 10px;
  background: rgba(31, 182, 255, 0.15);
  border: 1px solid rgba(31, 182, 255, 0.3);
  border-radius: 6px;
  font-size: 12px;
  color: rgba(31, 182, 255, 1);
  font-weight: 500;
}

.memory-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.memory-meta-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.memory-meta-item {
  font-size: 13px;
  color: var(--text-tertiary);
}

.memory-meta-divider {
  color: var(--border-medium);
  font-size: 12px;
}

.memory-actions {
  display: flex;
  gap: 8px;
}

.memory-action-btn {
  padding: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.memory-action-btn:hover {
  background: linear-gradient(135deg, rgba(31, 182, 255, 0.15), rgba(31, 182, 255, 0.08));
  border-color: rgba(31, 182, 255, 0.4);
  color: rgba(31, 182, 255, 1);
  transform: translateY(-1px) scale(1.05);
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.15),
    0 0 16px rgba(31, 182, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.memory-action-btn:active {
  transform: translateY(0) scale(0.95);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.15),
    inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.memory-action-btn svg {
  width: 16px;
  height: 16px;
}

/* ============================================
   BUTTONS - PREMIUM DESIGN SYSTEM
   Apple-quality with multi-layer shadows, depth, and sophistication
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  letter-spacing: -0.01em;
}

/* ===== PRIMARY BUTTON - Premium Multi-Layer Design ===== */
.btn-primary {
  background: linear-gradient(135deg, #1fb6ff 0%, #14b8a6 100%);
  color: #ffffff;
  /* Multi-layer shadow for depth (Apple-style) */
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.2),
    0 4px 12px rgba(31, 182, 255, 0.4),
    0 8px 24px rgba(31, 182, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Subtle inner glow */
.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.15) 0%,
    transparent 50%,
    rgba(255, 255, 255, 0.05) 100%
  );
  opacity: 1;
  transition: opacity 0.3s;
  pointer-events: none;
}

/* Hover glow overlay */
.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.2), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.btn-primary:hover {
  /* Enhanced multi-layer glow on hover */
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.25),
    0 8px 24px rgba(31, 182, 255, 0.5),
    0 16px 48px rgba(31, 182, 255, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(-2px) scale(1.01);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-primary:hover::after {
  opacity: 1;
}

/* Premium press effect with depth */
.btn-primary:active {
  transform: translateY(0) scale(0.98);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.3),
    0 2px 6px rgba(31, 182, 255, 0.3),
    inset 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: all 0.1s;
}

/* ===== SECONDARY BUTTON - Glass Morphism Premium ===== */
.btn-secondary {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(31, 182, 255, 0.3);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: linear-gradient(135deg, rgba(31, 182, 255, 0.15), rgba(31, 182, 255, 0.08));
  border-color: rgba(31, 182, 255, 0.5);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.2),
    0 0 24px rgba(31, 182, 255, 0.2),
    0 0 0 1px rgba(31, 182, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.btn-secondary:active {
  transform: translateY(0) scale(0.98);
  box-shadow:
    0 1px 4px rgba(0, 0, 0, 0.2),
    inset 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* ===== GHOST BUTTON - Subtle Premium ===== */
.btn-ghost {
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
  backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.95);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.btn-ghost:active {
  transform: translateY(0) scale(0.98);
  background: rgba(255, 255, 255, 0.06);
}

/* ===== SIZES ===== */
.btn-small {
  padding: 10px 20px;
  font-size: 13px;
  border-radius: 10px;
}

.btn-large {
  padding: 16px 32px;
  font-size: 16px;
  border-radius: 14px;
}

/* ===== DISABLED STATE ===== */
.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ============================================
   INPUTS
   ============================================ */

.input-group {
  margin-bottom: var(--space-lg);
}

.input-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}

.input {
  width: 100%;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(28, 28, 30, 0.8), rgba(44, 44, 46, 0.7));
  border: 1px solid rgba(31, 182, 255, 0.25);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.95);
  font-size: 15px;
  transition: all 0.2s;
  font-family: inherit;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.input:hover {
  border-color: rgba(31, 182, 255, 0.35);
  background: linear-gradient(135deg, rgba(28, 28, 30, 0.9), rgba(44, 44, 46, 0.8));
}

.input:focus {
  outline: none;
  border-color: rgba(31, 182, 255, 0.6);
  box-shadow:
    0 0 0 4px rgba(31, 182, 255, 0.15),
    0 4px 12px rgba(0, 0, 0, 0.3);
  background: linear-gradient(135deg, rgba(28, 28, 30, 1), rgba(44, 44, 46, 0.9));
}

.input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

/* ============================================
   LOADING & EMPTY STATES
   ============================================ */

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(59, 157, 255, 0.03) 25%,
    rgba(59, 157, 255, 0.08) 50%,
    rgba(59, 157, 255, 0.03) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
}

.empty-icon {
  font-size: 64px;
  opacity: 0.4;
  margin-bottom: var(--space-lg);
}

.empty-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.empty-message {
  color: var(--text-secondary);
  font-size: 16px;
  margin-bottom: var(--space-xl);
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* ============================================
   TOASTS
   ============================================ */

.toast {
  position: fixed;
  top: var(--space-xl);
  right: var(--space-xl);
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-lg);
  z-index: 400;
  animation: slideIn 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 300px;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.success {
  border-left: 3px solid var(--success-green);
}

.toast.error {
  border-left: 3px solid var(--hot-red);
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Hide mobile menu overlay on desktop by default */
.mobile-menu-overlay {
  display: none;
}

.mobile-bottom-nav {
  display: none;
}

@media (max-width: 1024px) {
  .nav-links {
    gap: var(--space-xs);
  }

  .nav-item {
    padding: var(--space-sm);
    font-size: 14px;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

@media (max-width: 640px) {
  .navbar {
    padding: var(--space-sm) var(--space-lg);
    flex-wrap: nowrap;
    height: auto;
    min-height: 64px;
  }

  .nav-left {
    flex: 1;
    gap: var(--space-lg);
  }

  .nav-links {
    display: none;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  /* Add padding to main content to account for bottom nav */
  #app-content {
    padding-bottom: 80px;
  }

  /* Prevent body scroll when mobile menu is open */
  body.mobile-menu-open {
    overflow: hidden;
  }

  /* Mobile Bottom Navigation */
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    padding: 0 max(8px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-right));
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 12px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s;
    min-width: 60px;
    position: relative;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(59, 130, 246, 0.2);
  }

  .mobile-nav-item .nav-icon {
    font-size: 20px;
    transition: transform 0.2s;
  }

  .mobile-nav-item.active {
    color: var(--primary-blue);
    background: rgba(59, 130, 246, 0.1);
  }

  .mobile-nav-item.active .nav-icon {
    transform: scale(1.1);
  }

  .mobile-nav-item:active {
    transform: scale(0.95);
  }

  /* Hamburger Menu Button */
  .hamburger-btn {
    display: none; /* Hidden by default on desktop */
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
  }

  /* Show hamburger on mobile */
  @media (max-width: 640px) {
    .hamburger-btn {
      display: flex;
    }
  }

  .hamburger-icon {
    width: 24px;
    height: 20px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .hamburger-icon span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s;
  }

  .hamburger-btn.active .hamburger-icon span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
  }

  .hamburger-btn.active .hamburger-icon span:nth-child(2) {
    opacity: 0;
  }

  .hamburger-btn.active .hamburger-icon span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
  }

  /* Mobile Menu Overlay */
  .mobile-menu-overlay {
    position: fixed;
    top: calc(80px + env(safe-area-inset-top, 0px));
    left: 0;
    right: 0;
    bottom: 60px;
    background: var(--bg-primary);
    z-index: 99;
    display: none;
    flex-direction: column;
    padding: var(--space-xl);
    padding-top: calc(var(--space-xl) + 32px);
    overflow-y: auto;
    animation: slideDown 0.3s ease-out;
  }

  .mobile-menu-overlay.show {
    display: flex;
  }

  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .mobile-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
    text-decoration: none;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(59, 130, 246, 0.2);
  }

  .mobile-menu-item:active {
    transform: scale(0.98);
    background: var(--bg-elevated);
  }

  .mobile-menu-item .menu-icon {
    font-size: 24px;
  }

  /* Add bottom padding to main content for bottom nav */
  #app-content {
    padding-bottom: 80px;
  }

  /* Hide desktop user menu on mobile */
  .user-menu {
    display: none;
  }
}

/* ============================================
   VALUE-FIRST DASHBOARD STYLES
   ============================================ */

.value-metric {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.value-number {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.value-label {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.value-trend {
  font-size: 12px;
  color: var(--text-tertiary);
}

.platform-bar {
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  transition: all var(--timing-fast);
}

.platform-bar:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-medium);
}

.progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmerProgress 2s infinite;
}

@keyframes shimmerProgress {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(200%);
  }
}

.health-metric {
  margin-bottom: 20px;
}

.health-metric:last-child {
  margin-bottom: 0;
}

.correlation-card {
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--timing-fast);
}

.correlation-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-medium);
  transform: translateY(-2px);
}

.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  color: white;
}

.platform-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.activity-card {
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  transition: all var(--timing-fast);
  cursor: pointer;
}

.activity-card:last-child {
  margin-bottom: 0;
}

.activity-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-medium);
  transform: translateX(4px);
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 26, 0.95) !important;
  backdrop-filter: blur(16px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  animation: fadeIn 200ms ease-out;
}

.modal-content {
  background: linear-gradient(135deg, rgba(28, 28, 30, 0.98), rgba(44, 44, 46, 0.98)) !important;
  border: 1px solid rgba(31, 182, 255, 0.3) !important;
  border-radius: 20px !important;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.6),
    0 0 80px rgba(31, 182, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  animation: slideUp 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  z-index: 301;
  backdrop-filter: blur(20px);
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid rgba(31, 182, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(31, 182, 255, 0.08), rgba(20, 184, 166, 0.08));
}

.modal-header h2,
.modal-header h3 {
  color: rgba(255, 255, 255, 0.95);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.modal-body {
  padding: 24px;
  color: rgba(255, 255, 255, 0.9);
  max-height: calc(90vh - 180px);
  overflow-y: auto;
  line-height: 1.6;
}

.modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: rgba(59, 157, 255, 0.3);
  border-radius: 4px;
}

.modal-footer {
  padding: var(--space-xl);
  border-top: 1px solid rgba(59, 157, 255, 0.15);
  display: flex;
  gap: var(--space-md);
  justify-content: flex-end;
  background: rgba(10, 14, 26, 0.5);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

/* Info blue color variable */
:root {
  --info-blue: #1fb6ff;
}

/* View Mode Toggle */
.view-toggle {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  margin-right: 20px;
}

.toggle-btn {
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-btn:hover {
  color: rgba(255, 255, 255, 0.9);
}

.toggle-btn.active {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

/* ============================================
   TOOLTIPS
   ============================================ */

.tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
  border-bottom: 1px dotted rgba(255, 255, 255, 0.4);
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 14, 26, 0.98);
  color: white;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  white-space: nowrap;
  max-width: 280px;
  white-space: normal;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s,
    visibility 0.2s,
    transform 0.2s;
  border: 1px solid rgba(59, 157, 255, 0.3);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.6),
    0 0 32px rgba(59, 157, 255, 0.2);
  z-index: 300;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.tooltip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid rgba(0, 0, 0, 0.95);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s,
    visibility 0.2s;
  z-index: 301;
}

.tooltip:hover::after,
.tooltip:hover::before {
  opacity: 1;
  visibility: visible;
}

.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(59, 157, 255, 0.2);
  color: var(--primary-blue);
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
  cursor: help;
  position: relative;
  transition: all var(--timing-fast);
}

.tooltip-icon:hover {
  background: rgba(59, 157, 255, 0.35);
  box-shadow: 0 0 12px rgba(59, 157, 255, 0.3);
  transform: scale(1.1);
}

/* ============================================
   CONVERSATIONS/MEMORIES VIEW
   ============================================ */

.conversations-view {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: calc(100vh - 60px);
  gap: 0;
}

.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  padding: var(--space-lg);
  overflow-y: auto;
  height: 100%;
}

.sidebar-search {
  position: relative;
  margin-bottom: var(--space-xl);
}

.sidebar-search input {
  width: 100%;
  padding: 12px 12px 12px 40px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  transition: all var(--timing-fast);
}

.sidebar-search input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(59, 157, 255, 0.1);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: 0.5;
}

.sidebar-section {
  margin-bottom: var(--space-xl);
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: var(--space-sm);
  padding-left: var(--space-xs);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-list .nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--timing-fast);
  cursor: pointer;
}

.nav-list .nav-item:hover {
  background: rgba(59, 157, 255, 0.08);
  color: var(--text-primary);
}

.nav-list .nav-item.active {
  background: linear-gradient(135deg, rgba(59, 157, 255, 0.15), rgba(0, 217, 197, 0.1));
  color: var(--text-primary);
  border: 1px solid rgba(59, 157, 255, 0.2);
}

.nav-icon {
  font-size: 16px;
  opacity: 0.8;
}

.nav-label {
  flex: 1;
}

.nav-count {
  font-size: 12px;
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  min-width: 24px;
  text-align: center;
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xl);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.header-left h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
  background: linear-gradient(135deg, #ffffff, rgba(255, 255, 255, 0.8));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-left .subtitle {
  color: var(--text-secondary);
  font-size: 15px;
}

.header-right {
  display: flex;
  gap: var(--space-sm);
}

.memories-container {
  padding: var(--space-xl);
  overflow-y: auto;
  height: calc(100vh - 200px);
}

.memories-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.memories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-lg);
}

/* ============================================
   ADDITIONAL POLISH
   ============================================ */

/* Loading states */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xl);
  color: var(--text-secondary);
  font-size: 16px;
}

/* Focus visible for accessibility */
*:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================
   MOBILE NATIVE EXPERIENCE
   ============================================ */

/* Safe area support for notched devices - only apply to specific containers */
.navbar {
  padding-top: max(12px, env(safe-area-inset-top));
  padding-left: max(32px, env(safe-area-inset-left));
  padding-right: max(32px, env(safe-area-inset-right));
}

#app-content {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* Mobile-specific optimizations */
@media (max-width: 768px) {
  /* Native scrolling behavior */
  * {
    -webkit-overflow-scrolling: touch;
    -webkit-tap-highlight-color: rgba(59, 157, 255, 0.1);
  }

  /* Prevent zoom on input focus */
  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Better touch targets */
  button,
  a,
  .btn,
  .nav-item {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Native feeling cards */
  .card {
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition:
      transform 0.2s ease,
      box-shadow 0.2s ease;
  }

  .card:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  }

  /* iOS-style bottom navigation */
  .nav-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(10, 14, 26, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 0.5px solid rgba(255, 255, 255, 0.1);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 100;
  }

  /* Bounce scroll effect */
  html,
  body {
    overscroll-behavior-y: contain;
  }

  /* Pull-to-refresh indicator */
  .refresh-indicator {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    border: 2px solid rgba(59, 157, 255, 0.3);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .refresh-indicator.visible {
    opacity: 1;
  }

  @keyframes spin {
    to {
      transform: translateX(-50%) rotate(360deg);
    }
  }

  /* Native list items */
  .memory-list-item,
  .conversation-item,
  .notification-item {
    background: var(--bg-elevated);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 8px;
    transition:
      background 0.15s ease,
      transform 0.15s ease;
    cursor: pointer;
    user-select: none;
  }

  .memory-list-item:active,
  .conversation-item:active,
  .notification-item:active {
    background: rgba(59, 157, 255, 0.1);
    transform: scale(0.98);
  }

  /* Native swipe actions */
  .swipeable {
    position: relative;
    overflow: hidden;
  }

  .swipe-actions {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    background: var(--hot-red);
    transform: translateX(100%);
    transition: transform 0.3s ease;
  }

  .swipeable.swiped .swipe-actions {
    transform: translateX(0);
  }

  /* Material Design ripple effect for Android */
  @media (hover: none) {
    .btn,
    .card,
    .memory-list-item,
    .conversation-item {
      position: relative;
      overflow: hidden;
    }

    .btn::after,
    .card::after,
    .memory-list-item::after,
    .conversation-item::after {
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      width: 0;
      height: 0;
      border-radius: 50%;
      background: rgba(59, 157, 255, 0.3);
      transform: translate(-50%, -50%);
      transition:
        width 0.4s ease,
        height 0.4s ease,
        opacity 0.4s ease;
      opacity: 0;
      pointer-events: none;
    }

    .btn:active::after,
    .card:active::after,
    .memory-list-item:active::after,
    .conversation-item:active::after {
      width: 200px;
      height: 200px;
      opacity: 1;
    }
  }

  /* iOS-style section headers */
  .section-header {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    padding: 8px 16px;
    margin-top: 24px;
    margin-bottom: 8px;
    background: transparent;
  }

  /* Native toggle switches */
  .toggle-switch {
    position: relative;
    width: 51px;
    height: 31px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    cursor: pointer;
    transition: background 0.3s ease;
  }

  .toggle-switch.active {
    background: var(--primary-blue);
  }

  .toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 27px;
    height: 27px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  }

  .toggle-switch.active::after {
    transform: translateX(20px);
  }

  /* Native modal/sheet presentation */
  .modal,
  .bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-radius: 24px 24px 0 0;
    padding: 24px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 300;
    max-height: 90vh;
    overflow-y: auto;
  }

  .modal.visible,
  .bottom-sheet.visible {
    transform: translateY(0);
  }

  .modal-handle {
    width: 36px;
    height: 5px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    margin: 0 auto 20px;
  }

  /* Backdrop for modals */
  .modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 299;
    pointer-events: none;
  }

  .modal-backdrop.visible {
    opacity: 1;
    pointer-events: all;
  }

  /* Native loading spinner */
  .spinner-native {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
  }

  /* iOS-style segmented control */
  .segmented-control {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 2px;
    gap: 2px;
  }

  .segmented-control button {
    flex: 1;
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s ease;
  }

  .segmented-control button.active {
    background: var(--bg-elevated);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  }

  /* Native feedback for interactions */
  button:active,
  .btn:active {
    opacity: 0.6;
    transition: opacity 0.1s ease;
  }

  /* Smooth momentum scrolling */
  .scroll-container {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }

  /* Hide desktop-only elements */
  .desktop-only {
    display: none !important;
  }

  /* Adjust main content for bottom nav */
  .main-content {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }
}

/* iOS-specific styles */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 768px) {
    /* iOS blur effects */
    .nav-bottom,
    .modal,
    .bottom-sheet {
      background: rgba(10, 14, 26, 0.85);
      backdrop-filter: blur(40px) saturate(180%);
      -webkit-backdrop-filter: blur(40px) saturate(180%);
    }

    /* iOS haptic feedback simulation */
    .btn:active,
    .card:active {
      -webkit-tap-highlight-color: transparent;
    }

    /* iOS-style shadows */
    .card {
      box-shadow: 0 2px 16px rgba(0, 0, 0, 0.12);
    }
  }
}

/* Android-specific styles */
@media (max-width: 768px) and (hover: none) and (pointer: coarse) {
  /* Material Design elevation */
  .card {
    box-shadow:
      0 2px 4px rgba(0, 0, 0, 0.2),
      0 1px 10px rgba(0, 0, 0, 0.12);
  }

  .card:active {
    box-shadow:
      0 8px 16px rgba(0, 0, 0, 0.2),
      0 4px 20px rgba(0, 0, 0, 0.12);
  }

  /* Material Design floating action button */
  .fab {
    position: fixed;
    bottom: calc(16px + env(safe-area-inset-bottom));
    right: 16px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-blue);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99;
    transition:
      transform 0.2s ease,
      box-shadow 0.2s ease;
  }

  .fab:active {
    transform: scale(0.95);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  }
}

/* ===== ENHANCED GLOBAL MOBILE STYLES ===== */

/* Prevent horizontal scroll on all pages */
html,
body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Responsive images and media */
img,
video,
iframe,
canvas {
  max-width: 100%;
  height: auto;
}

/* Touch-friendly global styles */
@media (hover: none) and (pointer: coarse) {
  /* All buttons and interactive elements */
  button,
  .btn,
  a[class*='btn'],
  [role='button'],
  input[type='submit'],
  input[type='button'] {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 20px;
  }

  /* Form inputs */
  input:not([type='checkbox']):not([type='radio']),
  textarea,
  select {
    min-height: 44px;
    font-size: 16px !important; /* Prevents iOS zoom */
    padding: 10px 14px;
  }

  /* Checkbox and radio - larger touch targets */
  input[type='checkbox'],
  input[type='radio'] {
    width: 20px;
    height: 20px;
    margin: 8px;
  }

  /* Links - add padding for easier tapping */
  a {
    padding: 4px 8px;
    margin: -4px -8px;
  }

  /* Remove hover effects on touch devices */
  *:hover {
    /* Disable hover transforms */
  }

  /* Add active/tap feedback instead */
  button:active,
  .btn:active,
  a[class*='btn']:active {
    transform: scale(0.98);
    opacity: 0.9;
  }

  /* Prevent text selection on UI elements */
  button,
  .btn,
  .nav-item,
  .tab,
  .card,
  [role='button'] {
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  /* Better active states for cards */
  .card:active,
  .memory-card:active {
    transform: translateY(2px);
    opacity: 0.95;
  }
}

/* iOS-specific fixes */
@supports (-webkit-touch-callout: none) {
  /* Fix iOS input zoom (16px minimum) */
  input,
  textarea,
  select {
    font-size: 16px !important;
  }

  /* Fix iOS safe area for fixed elements */
  nav,
  .navbar,
  header {
    padding-top: max(0px, env(safe-area-inset-top));
  }

  footer,
  .bottom-nav {
    padding-bottom: max(0px, env(safe-area-inset-bottom));
  }

  /* Fix iOS momentum scrolling */
  .modal,
  .sidebar,
  .dropdown-menu {
    -webkit-overflow-scrolling: touch;
  }

  /* Fix iOS button styling */
  button,
  input[type='submit'],
  input[type='button'] {
    -webkit-appearance: none;
    appearance: none;
  }
}

/* Small phone screens (iPhone SE, older Android) */
@media (max-width: 375px) {
  /* Smaller text */
  body {
    font-size: 14px;
  }

  h1 {
    font-size: 24px !important;
  }

  h2 {
    font-size: 20px !important;
  }

  h3 {
    font-size: 18px !important;
  }

  /* Reduce padding */
  .container,
  section {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  /* Smaller buttons */
  .btn,
  button {
    padding: 10px 16px;
    font-size: 14px;
  }
}

/* Tablet landscape and below */
@media (max-width: 1024px) {
  /* Reduce container max-width */
  .container {
    max-width: 100%;
    padding-left: 20px;
    padding-right: 20px;
  }

  /* Stack multi-column layouts */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }
}

/* Mobile portrait */
@media (max-width: 640px) {
  /* Full-width containers */
  .container,
  section {
    padding: 16px;
  }

  /* Stack all grids */
  [class*='grid'] {
    grid-template-columns: 1fr !important;
  }

  /* Full-width buttons */
  .button-group {
    flex-direction: column;
  }

  .button-group .btn {
    width: 100%;
  }

  /* Hide sidebars by default */
  .sidebar {
    transform: translateX(-100%);
  }

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

/* Landscape mobile (phones in landscape) */
@media (max-height: 500px) and (orientation: landscape) {
  /* Reduce vertical spacing */
  section {
    padding-top: 40px !important;
    padding-bottom: 40px !important;
  }

  h1 {
    font-size: 28px !important;
  }

  /* Compact nav */
  nav,
  .navbar {
    padding: 8px 16px !important;
  }

  /* Hide large decorative elements */
  .hero-image,
  .decorative {
    display: none;
  }
}

/* Accessibility - prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  button,
  .btn {
    border: 2px solid currentColor;
  }

  .card {
    border: 1px solid currentColor;
  }
}

/* Dark mode support (if not already implemented) */
@media (prefers-color-scheme: dark) {
  /* This is already handled by your design, but adding for completeness */
  :root {
    color-scheme: dark;
  }
}
