/* LUMEO — Global Design System v4.0 */
/* Brand: Premium emotional connection platform */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Playfair+Display:ital,wght@0,400;0,700;1,400&display=swap');

/* ── Theme Variables ─────────────────────────────────────────── */
:root {
  /* Dark theme (default) */
  --lumeo-void:       #08080f;
  --lumeo-deep:       #0d0d1a;
  --lumeo-surface:    #13131f;
  --lumeo-card:       #1a1a2e;
  --lumeo-elevated:   #212136;
  --lumeo-border:     rgba(255,255,255,0.07);
  --lumeo-border-hi:  rgba(255,255,255,0.14);

  --lumeo-violet:     #7c3aed;
  --lumeo-violet-lo:  #4527a0;
  --lumeo-violet-hi:  #a78bfa;
  --lumeo-violet-glow:rgba(124,58,237,0.35);

  --lumeo-rose:       #e11d7a;
  --lumeo-rose-lo:    #9b1159;
  --lumeo-rose-hi:    #f472b6;
  --lumeo-rose-glow:  rgba(225,29,122,0.35);

  --lumeo-gold:       #d4a054;
  --lumeo-gold-hi:    #f0c07a;

  /* Testo con contrasto WCAG AA garantito */
  --lumeo-text:       #f0f0f8;
  --lumeo-text-2:     #c0c0d8;
  --lumeo-text-3:     #8888aa;
  --lumeo-text-4:     #555570;

  --lumeo-success:    #22c55e;
  --lumeo-warning:    #f59e0b;
  --lumeo-error:      #ef4444;

  --grad-primary:  linear-gradient(135deg, #7c3aed 0%, #e11d7a 100%);
  --grad-surface:  linear-gradient(180deg, #1a1a2e 0%, #13131f 100%);
  --grad-hero:     radial-gradient(ellipse at 30% 30%, rgba(124,58,237,0.15) 0%, transparent 50%),
                   radial-gradient(ellipse at 70% 70%, rgba(225,29,122,0.12) 0%, transparent 50%),
                   linear-gradient(180deg, #0d0d1a 0%, #08080f 100%);

  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;

  --s1: 4px;  --s2: 8px;   --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 40px;  --s8: 48px; --s9: 64px; --s10: 80px;

  --r-sm:   8px;  --r-md: 12px; --r-lg: 20px; --r-xl: 28px; --r-full: 9999px;

  --shadow-sm:     0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.6);
  --shadow-glow-v: 0 0 24px rgba(124,58,237,0.4), 0 0 8px rgba(124,58,237,0.2);
  --shadow-glow-r: 0 0 24px rgba(225,29,122,0.4), 0 0 8px rgba(225,29,122,0.2);

  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:    cubic-bezier(0, 0, 0.2, 1);

  --dur-fast:  120ms;  --dur-base: 240ms;  --dur-slow: 400ms;  --dur-xslow: 600ms;

  /* Nav */
  --nav-w: 220px;
  --nav-h: 64px;
}

/* ── Light Theme ─────────────────────────────────────────────── */
[data-theme="light"] {
  --lumeo-void:       #f4f4fb;
  --lumeo-deep:       #eaeaf5;
  --lumeo-surface:    #ffffff;
  --lumeo-card:       #ffffff;
  --lumeo-elevated:   #f0f0fa;
  --lumeo-border:     rgba(0,0,0,0.08);
  --lumeo-border-hi:  rgba(0,0,0,0.14);

  --lumeo-text:       #0f0f1a;
  --lumeo-text-2:     #383850;
  --lumeo-text-3:     #60607a;
  --lumeo-text-4:     #9090a8;

  --grad-hero:     radial-gradient(ellipse at 30% 30%, rgba(124,58,237,0.08) 0%, transparent 50%),
                   radial-gradient(ellipse at 70% 70%, rgba(225,29,122,0.06) 0%, transparent 50%),
                   linear-gradient(180deg, #eaeaf5 0%, #f4f4fb 100%);

  --shadow-sm:     0 1px 3px rgba(0,0,0,0.1);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.15);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  background: var(--lumeo-void);
  color: var(--lumeo-text);
  line-height: 1.6;
  min-height: 100dvh;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}

/* ── Typography ─────────────────────────────────────────────── */
.text-display-1 { font-size: clamp(2.5rem, 6vw, 5rem);    font-weight: 800; letter-spacing: -0.04em; line-height: 1.05; }
.text-display-2 { font-size: clamp(2rem, 4.5vw, 3.5rem);  font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.text-h1        { font-size: clamp(1.5rem, 3vw, 2.25rem);  font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.text-h2        { font-size: clamp(1.25rem, 2.5vw, 1.75rem); font-weight: 600; letter-spacing: -0.015em; }
.text-h3        { font-size: clamp(1.1rem, 2vw, 1.4rem);   font-weight: 600; }
.text-body-lg   { font-size: 1.0625rem; line-height: 1.7; }
.text-body      { font-size: 0.9375rem; line-height: 1.65; }
.text-body-sm   { font-size: 0.8125rem; line-height: 1.55; }
.text-caption   { font-size: 0.75rem;   letter-spacing: 0.04em; }
.text-label     { font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }

.font-serif   { font-family: var(--font-serif); }
.text-gradient { background: var(--grad-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.text-muted   { color: var(--lumeo-text-2); }
.text-faint   { color: var(--lumeo-text-3); }
.truncate     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Layout ──────────────────────────────────────────────────── */
.page {
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  grid-template-rows: 1fr;
  min-height: 100dvh;
  min-height: 100vh;
}

#main-content {
  grid-column: 2;
  grid-row: 1;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100dvh;
  height: 100vh;
}

.flex-1 { flex: 1; }
.w-full { width: 100%; }
.truncate { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--lumeo-card);
  border: 1px solid var(--lumeo-border);
  border-radius: var(--r-lg);
  padding: var(--s5);
  transition: border-color var(--dur-base) var(--ease-smooth),
              box-shadow var(--dur-base) var(--ease-smooth);
}
.card:hover { border-color: var(--lumeo-border-hi); }
.card--glass {
  background: rgba(13,13,26,0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
[data-theme="light"] .card--glass {
  background: rgba(255,255,255,0.75);
}
.card--gradient {
  background: linear-gradient(135deg, rgba(124,58,237,0.12) 0%, rgba(225,29,122,0.08) 100%);
  border-color: rgba(124,58,237,0.2);
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1;
  padding: 10px 18px;
  border-radius: var(--r-md);
  border: none;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-smooth);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn:disabled { opacity: 0.5; pointer-events: none; }

.btn-primary {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 2px 12px rgba(124,58,237,0.25);
}
.btn-primary:hover { filter: brightness(1.1); box-shadow: 0 4px 20px rgba(124,58,237,0.4); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--lumeo-elevated);
  color: var(--lumeo-text);
  border: 1px solid var(--lumeo-border-hi);
}
.btn-secondary:hover { background: var(--lumeo-card); border-color: var(--lumeo-violet); color: var(--lumeo-violet-hi); }

.btn-ghost {
  background: transparent;
  color: var(--lumeo-text-2);
  border: 1px solid var(--lumeo-border);
}
.btn-ghost:hover { background: var(--lumeo-elevated); color: var(--lumeo-text); }

.btn-icon {
  padding: 10px;
  border-radius: var(--r-md);
  background: var(--lumeo-elevated);
  color: var(--lumeo-text-2);
  border: 1px solid var(--lumeo-border);
}
.btn-icon:hover { color: var(--lumeo-violet-hi); border-color: var(--lumeo-violet); }

.btn-sm  { padding: 6px 12px; font-size: 0.8125rem; border-radius: var(--r-sm); }
.btn-lg  { padding: 14px 24px; font-size: 1rem; }

/* ── Inputs ──────────────────────────────────────────────────── */
.input {
  width: 100%;
  background: var(--lumeo-elevated);
  border: 1px solid var(--lumeo-border-hi);
  border-radius: var(--r-md);
  color: var(--lumeo-text);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  padding: 10px 14px;
  outline: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.input::placeholder { color: var(--lumeo-text-3); }
.input:focus {
  border-color: var(--lumeo-violet);
  box-shadow: 0 0 0 3px var(--lumeo-violet-glow);
}
textarea.input { resize: vertical; line-height: 1.5; }

/* ── Navigation Sidebar ──────────────────────────────────────── */
.nav-sidebar {
  grid-column: 1;
  grid-row: 1;
  width: var(--nav-w);
  height: 100dvh;
  height: 100vh;
  background: var(--lumeo-surface);
  border-right: 1px solid var(--lumeo-border);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 0;
  overflow-y: auto;
  z-index: 100;
}

/* ── Navigation Bottom (mobile) ──────────────────────────────── */
.nav-bottom {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: var(--lumeo-surface);
  border-top: 1px solid var(--lumeo-border);
  z-index: 100;
  padding: 0 8px;
  align-items: center;
  justify-content: space-around;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* ── Nav Items ───────────────────────────────────────────────── */
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
  border-radius: var(--r-md);
  color: var(--lumeo-text-3);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--dur-base) var(--ease-smooth);
  font-size: 0.625rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  border: none;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
}
.nav-item:hover { color: var(--lumeo-text); background: var(--lumeo-elevated); }
.nav-item.active {
  color: var(--lumeo-violet-hi);
  background: rgba(124,58,237,0.12);
}
.nav-item svg { transition: transform var(--dur-base) var(--ease-spring); }
.nav-item:hover svg { transform: scale(1.1); }
.nav-item.active svg { transform: scale(1.05); }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--lumeo-elevated);
  color: var(--lumeo-text-2);
  border: 1px solid var(--lumeo-border-hi);
}
.badge-violet { background: rgba(124,58,237,0.18); color: var(--lumeo-violet-hi); border-color: rgba(124,58,237,0.3); }
.badge-rose   { background: rgba(225,29,122,0.18); color: var(--lumeo-rose-hi);   border-color: rgba(225,29,122,0.3); }
.badge-gold   { background: rgba(212,160,84,0.18); color: var(--lumeo-gold-hi);   border-color: rgba(212,160,84,0.3); }
.badge-success{ background: rgba(34,197,94,0.18);  color: #4ade80;               border-color: rgba(34,197,94,0.3); }

/* ── Level Badge ─────────────────────────────────────────────── */
.level-badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 0.6875rem;
  font-weight: 800;
  background: var(--grad-primary);
  color: #fff;
}

/* ── Progress Bar ────────────────────────────────────────────── */
.progress-track {
  width: 100%;
  height: 6px;
  background: var(--lumeo-elevated);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--grad-primary);
  border-radius: var(--r-full);
  transition: width 0.6s var(--ease-smooth);
}

/* ── Avatar Frame ────────────────────────────────────────────── */
.avatar-frame {
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--lumeo-border-hi);
  flex-shrink: 0;
}
.avatar-frame--glow-v { border-color: var(--lumeo-violet); box-shadow: var(--shadow-glow-v); }
.avatar-frame--glow-r { border-color: var(--lumeo-rose);   box-shadow: var(--shadow-glow-r); }

/* ── Chat Bubbles ────────────────────────────────────────────── */
.bubble {
  max-width: 72%;
  padding: 9px 13px;
  border-radius: 18px;
  font-size: 0.9375rem;
  line-height: 1.45;
  word-break: break-word;
}
.bubble--self {
  background: var(--grad-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.bubble--other {
  background: var(--lumeo-elevated);
  color: var(--lumeo-text);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--lumeo-border-hi);
}

/* ── Presence Dot ────────────────────────────────────────────── */
.presence-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--lumeo-card);
  display: inline-block;
  flex-shrink: 0;
}
.presence-online  { background: var(--lumeo-success); box-shadow: 0 0 6px rgba(34,197,94,0.6); }
.presence-away    { background: var(--lumeo-warning); }
.presence-offline { background: var(--lumeo-text-4); }

/* ── Animations ──────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity:0; transform:translateY(16px); }
  to   { opacity:1; transform:translateY(0); }
}
@keyframes scaleIn {
  from { opacity:0; transform:scale(0.92); }
  to   { opacity:1; transform:scale(1); }
}
@keyframes float {
  0%,100% { transform:translateY(0); }
  50%     { transform:translateY(-8px); }
}
@keyframes pulse-glow {
  0%,100% { box-shadow: 0 0 0 0 var(--lumeo-violet-glow); }
  50%     { box-shadow: 0 0 20px 4px var(--lumeo-violet-glow); }
}
@keyframes slideRight {
  from { opacity:0; transform:translateX(20px); }
  to   { opacity:1; transform:translateX(0); }
}
@keyframes spin {
  to { transform:rotate(360deg); }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.animate-fadeUp   { animation: fadeUp   var(--dur-slow) var(--ease-out) both; }
.animate-scaleIn  { animation: scaleIn  var(--dur-slow) var(--ease-spring) both; }
.animate-float    { animation: float    3s ease-in-out infinite; }

/* ── Skeleton ────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--lumeo-elevated) 25%, var(--lumeo-card) 50%, var(--lumeo-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-md);
}

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--lumeo-elevated); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--lumeo-border-hi); }

/* ── Modal overlay ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--lumeo-card);
  border: 1px solid var(--lumeo-border-hi);
  border-radius: var(--r-xl);
  padding: 28px;
  max-width: 440px;
  width: 100%;
  animation: scaleIn var(--dur-slow) var(--ease-spring) both;
}

/* ── Toast ───────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 80px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
  max-width: 320px;
}

/* ── Theme Toggle ────────────────────────────────────────────── */
.theme-toggle {
  position: relative;
  width: 52px; height: 28px;
  cursor: pointer;
}
.theme-toggle input { display:none; }
.theme-toggle-slider {
  position: absolute; inset: 0;
  background: var(--lumeo-elevated);
  border-radius: 14px;
  border: 1px solid var(--lumeo-border-hi);
  transition: background var(--dur-base);
}
.theme-toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  top: 3px; left: 3px;
  background: var(--lumeo-text-3);
  border-radius: 50%;
  transition: transform var(--dur-base) var(--ease-spring), background var(--dur-base);
}
.theme-toggle input:checked + .theme-toggle-slider { background: rgba(124,58,237,0.3); }
.theme-toggle input:checked + .theme-toggle-slider::before {
  transform: translateX(24px);
  background: var(--lumeo-violet-hi);
}

/* ── Map container ───────────────────────────────────────────── */
#lumeo-map-real {
  width: 100%; height: 100%;
  border: none;
}
#gmap-container {
  position: absolute; inset: 0; z-index: 1;
}

/* ── 3D World canvas ─────────────────────────────────────────── */
#world-canvas {
  position: absolute;
  inset: 0; width: 100%; height: 100%;
  display: block;
}

/* ── Onboarding ──────────────────────────────────────────────── */
.onboarding-step {
  animation: fadeUp var(--dur-slow) var(--ease-out) both;
}

/* ── Relationship status ring ────────────────────────────────── */
.bond-ring {
  width: 80px; height: 80px;
  border-radius: 50%;
  border: 3px solid transparent;
  background: linear-gradient(var(--lumeo-card), var(--lumeo-card)) padding-box,
              var(--grad-primary) border-box;
  display: flex; align-items: center; justify-content: center;
}

/* ── Instruction page ────────────────────────────────────────── */
.instruction-section {
  border-left: 3px solid var(--lumeo-violet);
  padding-left: 16px;
  margin-bottom: 20px;
}
.instruction-section h3 {
  color: var(--lumeo-violet-hi);
  margin-bottom: 6px;
}
.instruction-section p, .instruction-section li {
  color: var(--lumeo-text-2);
  font-size: 0.9375rem;
  line-height: 1.65;
}
.instruction-section ul { padding-left: 18px; }

/* ── Page header ─────────────────────────────────────────────── */
.page-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--lumeo-void);
  border-bottom: 1px solid var(--lumeo-border);
  padding: 14px 20px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .page {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }
  .nav-sidebar { display: none; }
  .nav-bottom  { display: flex; }
  #main-content {
    grid-column: 1;
    padding-bottom: var(--nav-h);
    height: 100dvh;
    height: 100vh;
  }
  #toast-container {
    bottom: 72px;
    left: 16px;
    right: 16px;
    max-width: none;
  }
}

@media (min-width: 769px) {
  .nav-bottom { display: none !important; }
  .nav-sidebar { display: flex; }
}
