/* ============================================================
   Vybe Space — Global Cozy Design System  (Sprint 12.5)
   cozy_design_system.css
   Unified emotional language across entire app
   Load after tokens.css, before page-specific CSS
   ============================================================ */

/* ── COZY PAGE THEME — Applied globally ───────────────────── */
.cozy-page {
  background: radial-gradient(ellipse at 20% 0%, #130827 0%, #06090f 60%, #020304 100%);
  position: relative;
}

.cozy-page::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ── Ambient Blob System ─────────────────────────────────── */
.cozy-blobs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.cozy-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.12;
  animation: cozyBlobDrift 18s ease-in-out infinite;
}

.cozy-blob--primary { width: 380px; height: 380px; background: #8b5cf6; top: -120px; left: -80px; animation-delay: 0s; }
.cozy-blob--secondary { width: 280px; height: 280px; background: #22d3ee; top: 30%; right: -100px; animation-delay: -6s; }
.cozy-blob--tertiary { width: 220px; height: 220px; background: #f472b6; bottom: 20%; left: 5%; animation-delay: -12s; }

@keyframes cozyBlobDrift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(20px, -30px) scale(1.05); }
  66% { transform: translate(-15px, 20px) scale(0.97); }
}

@media (prefers-reduced-motion: reduce) {
  .cozy-blob { animation: none; }
}

/* ── UNIFIED GLASS CARD SYSTEM ──────────────────────────── */
.cozy-card,
.cozy-glass {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  backdrop-filter: blur(12px);
}

/* Mobile performance: disable blur at ≤430px */
@media (max-width: 430px) {
  .cozy-card,
  .cozy-glass {
    backdrop-filter: none;
  }
}

/* ── SECTION TITLE SYSTEM ──────────────────────────────── */
.cozy-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #c4b5fd;
  margin: 0 0 0.75rem;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.cozy-section-subtitle {
  font-size: 0.78rem;
  color: #6b7280;
  margin: 0 0 0.5rem;
}

/* ── UNIFIED CHIP SYSTEM ────────────────────────────────── */
.cozy-chip,
.cozy-chip-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 2rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.875rem;
  color: #d8d3e8;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cozy-chip-btn:hover,
.cozy-chip:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.5);
  transform: translateY(-1px);
}

.cozy-chip--active,
.cozy-chip-btn--active {
  background: rgba(139, 92, 246, 0.3);
  border-color: #8b5cf6;
  color: #f0e8ff;
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.3);
}

/* Color variants */
.cozy-chip--purple { border-color: rgba(139, 92, 246, 0.3); }
.cozy-chip--cyan { border-color: rgba(34, 211, 238, 0.3); color: #67e8f9; }
.cozy-chip--pink { border-color: rgba(244, 114, 182, 0.3); color: #f9a8d4; }
.cozy-chip--green { border-color: rgba(52, 211, 153, 0.3); color: #6ee7b7; }

/* ── UNIFIED BUTTON SYSTEM ──────────────────────────────– */
.cozy-btn {
  border-radius: 2rem;
  padding: 0.45rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s ease, transform 0.12s ease;
  border: none;
}

.cozy-btn:hover { opacity: 0.88; transform: translateY(-1px); }

.cozy-btn--primary {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: white;
}

.cozy-btn--secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #c4b5fd;
}

.cozy-btn--ghost {
  background: none;
  color: #a78bfa;
}

/* ── UNIFIED POST/FEED CARD SYSTEM ──────────────────────– */
.cozy-post-card {
  padding: 1rem;
  transition: border-color 0.15s ease;
}

.cozy-post-header {
  display: flex;
  align-items: center;
  margin-bottom: 0.65rem;
}

.cozy-post-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  margin-right: 0.65rem;
}

.cozy-post-author {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: #e9d5ff;
}

.cozy-post-body {
  font-size: 0.92rem;
  line-height: 1.6;
  color: #d4c4f0;
  margin: 0 0 0.75rem;
  word-break: break-word;
}

.cozy-post-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ── REACTION BUTTON UNIFIED ────────────────────────────– */
.cozy-react-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 2rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.82rem;
  color: #94a3b8;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.cozy-react-btn:hover {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.3);
  transform: scale(1.05);
}

.cozy-react-btn--active {
  background: rgba(244, 63, 94, 0.2);
  border-color: rgba(244, 63, 94, 0.5);
  color: #fda4af;
}

/* ── PROFILE CARD UNIFIED ──────────────────────────────– */
.cozy-profile-card {
  padding: 1rem;
}

.cozy-profile-header {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  margin-bottom: 0.85rem;
}

.cozy-profile-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  flex-shrink: 0;
}

.cozy-profile-name { font-size: 1rem; font-weight: 700; margin: 0 0 0.3rem; color: #f0e8ff; }
.cozy-profile-bio { font-size: 0.82rem; color: #94a3b8; margin: 0 0 0.4rem; line-height: 1.45; }
.cozy-profile-vibes { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.cozy-vibe-tag {
  font-size: 0.72rem;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 1rem;
  padding: 0.15rem 0.55rem;
  color: #c4b5fd;
}

/* ── AVATAR SYSTEM ──────────────────────────────────────– */
.cozy-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 600;
  flex-shrink: 0;
}

.cozy-avatar--sm { width: 32px; height: 32px; font-size: 0.9rem; }
.cozy-avatar--md { width: 48px; height: 48px; font-size: 1.2rem; }
.cozy-avatar--lg { width: 64px; height: 64px; font-size: 1.8rem; }

/* Online indicator */
.cozy-avatar-online {
  position: relative;
}

.cozy-avatar-online::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4ade80;
  border: 2px solid #020304;
  bottom: 2px;
  right: 2px;
}

/* ── SPACING SYSTEM ────────────────────────────────────– */
.cozy-section { margin-bottom: 1.25rem; }
.cozy-section--tight { margin-bottom: 0.75rem; }
.cozy-section--loose { margin-bottom: 2rem; }

.cozy-gap-xs { gap: 0.35rem; }
.cozy-gap-sm { gap: 0.5rem; }
.cozy-gap-md { gap: 0.75rem; }
.cozy-gap-lg { gap: 1rem; }
.cozy-gap-xl { gap: 1.25rem; }

/* ── CONTENT WRAPPER ────────────────────────────────────– */
.cozy-content {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 0.75rem;
  position: relative;
  z-index: 1;
}

@media (max-width: 430px) {
  .cozy-content {
    padding: 0 0.5rem;
  }
}

/* ── RESPONSIVE LAYOUT ──────────────────────────────────– */
.cozy-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.cozy-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

@media (max-width: 430px) {
  .cozy-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 380px) {
  .cozy-grid-2 { grid-template-columns: 1fr; }
  .cozy-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* ── ANIMATIONS LIBRARY ────────────────────────────────– */
@keyframes cozyPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes cozyGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(139, 92, 246, 0.3); }
  50% { box-shadow: 0 0 16px rgba(139, 92, 246, 0.5); }
}

@keyframes cozyFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
}

.cozy-animate-pulse { animation: cozyPulse 2s ease-in-out infinite; }
.cozy-animate-glow { animation: cozyGlow 2.5s ease-in-out infinite; }
.cozy-animate-float { animation: cozyFloat 3s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .cozy-animate-pulse,
  .cozy-animate-glow,
  .cozy-animate-float {
    animation: none;
  }
}

/* ── UTILITY CLASSES ────────────────────────────────────– */
.cozy-hidden { display: none; }
.cozy-text-muted { color: #6b7280; }
.cozy-text-accent { color: #c4b5fd; }
.cozy-text-center { text-align: center; }
.cozy-mb-xs { margin-bottom: 0.35rem; }
.cozy-mb-sm { margin-bottom: 0.5rem; }
.cozy-mb-md { margin-bottom: 0.75rem; }
.cozy-mb-lg { margin-bottom: 1rem; }

/* ── REDUCED MOTION ────────────────────────────────────– */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* ══════════════════════════════════════════════════════════════
   CONTEXT-AWARE PAGE STYLES
   ══════════════════════════════════════════════════════════════ */

/* Feed page */
body.cozy-page--feed {
  background: radial-gradient(ellipse at 20% 0%, #130827 0%, #06090f 60%, #020304 100%);
}

/* Profile page */
body.cozy-page--profile {
  background: radial-gradient(ellipse at 50% 10%, #1a0f2e 0%, #06090f 60%, #020304 100%);
}

/* Rooms page */
body.cozy-page--rooms {
  background: radial-gradient(ellipse at 80% 20%, #0f0a1a 0%, #06090f 60%, #020304 100%);
}

/* Games page */
body.cozy-page--games {
  background: radial-gradient(ellipse at 30% 0%, #130827 0%, #06090f 60%, #020304 100%);
}

/* ════════════════════════════════════════════════════════════
   Page Headers & Typography (Sprint 13 additions)
   ════════════════════════════════════════════════════════════ */

.cozy-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
}

.cozy-page-title {
  font-size: 2rem;
  font-weight: 800;
  color: #f0e8ff;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}

.cozy-page-subtitle {
  font-size: 0.95rem;
  color: #cbd5e1;
  margin: 0;
  font-weight: 400;
}

@media (max-width: 680px) {
  .cozy-page-header {
    flex-direction: column;
    gap: 1rem;
  }

  .cozy-page-title {
    font-size: 1.65rem;
  }
}
