/* ==========================================================================
   INSOCIABLE — DESIGN SYSTEM MOBILE NATIVE & INSTAGRAM REELS IMMERSIVE
   ========================================================================== */

:root {
  --bg-main: #090a0f;
  --bg-surface: #12141c;
  --bg-surface-elevated: #1a1d28;
  --bg-glass: rgba(18, 20, 28, 0.75);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-glow: rgba(139, 92, 246, 0.35);
  --accent-gradient: linear-gradient(135deg, #f43f5e 0%, #a855f7 50%, #6366f1 100%);
  --accent-gradient-hover: linear-gradient(135deg, #e11d48 0%, #9333ea 50%, #4f46e5 100%);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glass: rgba(255, 255, 255, 0.12);
  --border-active: rgba(139, 92, 246, 0.5);
  
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --success: #10b981;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-full: 9999px;
  
  --header-height: 56px;
  --bottom-nav-height: 60px;
  --max-app-width: 480px; /* Largeur optimale Instagram mobile */
  
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  user-select: none;
}

/* Typographie */
h1, h2, h3, h4 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* Structure App Shell */
.app-viewport {
  width: 100%;
  max-width: var(--max-app-width);
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: #000000;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}

@media (min-width: 641px) {
  .app-viewport {
    height: 98vh;
    margin: 1vh auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
  }
}

/* Barre haute (Top Bar) */
.top-bar {
  height: var(--header-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(9, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-ar-badge {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo-ar-badge:hover {
  transform: scale(1.05);
}

.logo-ar-img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
}

.brand-text-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  letter-spacing: -0.04em;
  line-height: 1;
}

.brand-anti {
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.03em;
}

.brand-reseau {
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.03em;
}

.brand-dot {
  color: #ff0055;
  font-weight: 900;
  font-size: 22px;
  margin-left: -4px;
}

.brand-live-badge {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffffff;
  background: #ff0055;
  padding: 3px 6px;
  border-radius: 6px;
  line-height: 1;
  box-shadow: 0 0 12px rgba(255, 0, 85, 0.4);
  margin-left: 2px;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-btn:hover, .icon-btn:active {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

/* Conteneur de Snap Scroll (1 post par écran - Un après l'autre) */
.reels-container {
  flex: 1;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  position: relative;
  scrollbar-width: none; /* Firefox */
}

.reels-container::-webkit-scrollbar {
  display: none; /* Chrome / Safari */
}

/* Publication individuelle (1 écran plein) */
.reel-item {
  width: 100%;
  height: calc(100vh - var(--header-height) - var(--bottom-nav-height));
  scroll-snap-align: start;
  scroll-snap-stop: always;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #060709;
}

@media (min-width: 641px) {
  .reel-item {
    height: calc(98vh - var(--header-height) - var(--bottom-nav-height));
  }
}

/* Média principal : Image, Vidéo, Audio, Texte */
.media-display-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Arrière-plan flou d'ambiance pour les images et vidéos */
.ambient-backdrop {
  position: absolute;
  inset: -20px;
  background-size: cover;
  background-position: center;
  filter: blur(35px) brightness(0.35);
  transform: scale(1.15);
  z-index: 1;
}

.media-element {
  position: relative;
  z-index: 2;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Style spécifique Vidéo */
.video-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.video-element {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.play-pause-badge {
  position: absolute;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  z-index: 5;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Style spécifique Audio */
.audio-card-wrapper {
  width: 86%;
  padding: 32px 24px;
  background: linear-gradient(145deg, rgba(30, 27, 46, 0.9), rgba(18, 16, 28, 0.95));
  backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  z-index: 2;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.audio-vinyl {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, #2d2640 20%, #151221 70%, #0d0a17 100%);
  border: 4px solid rgba(139, 92, 246, 0.4);
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  animation: spin 8s linear infinite;
}

.audio-vinyl.paused {
  animation-play-state: paused;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Style Carte Texte Seul (format typographique Instagram Story / Quote) */
.text-quote-wrapper {
  width: 88%;
  max-width: 400px;
  padding: 40px 28px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #1c152e 0%, #11101d 50%, #181b2a 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
  z-index: 2;
  position: relative;
}

.text-quote-wrapper::before {
  content: '“';
  position: absolute;
  top: 10px;
  left: 20px;
  font-size: 72px;
  font-family: Georgia, serif;
  color: rgba(139, 92, 246, 0.25);
  line-height: 1;
}

.quote-content {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.5;
  color: #f1f5f9;
  white-space: pre-wrap;
  word-break: break-word;
  position: relative;
  z-index: 2;
}

/* Overlay Informations (Bas Gauche) */
.reel-overlay-info {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 76px;
  z-index: 10;
  pointer-events: none;
}

.reel-overlay-info * {
  pointer-events: auto;
}

.author-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  padding: 4px 12px 4px 4px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.author-chip-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: white;
}

.author-chip-name {
  font-weight: 700;
  font-size: 14px;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

.reel-caption {
  font-size: 14px;
  line-height: 1.45;
  color: #f8fafc;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  margin-bottom: 6px;
  max-height: 4.2em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.reel-meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #cbd5e1;
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 8px;
  border-radius: 4px;
}

/* Barre d'Actions Flottante Latérale (Côté Droit façon Instagram Reels) */
.reel-actions-dock {
  position: absolute;
  right: 12px;
  bottom: 24px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.reel-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #ffffff;
  transition: transform 0.15s ease;
}

.reel-action-btn:active {
  transform: scale(0.9);
}

.reel-action-circle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(18, 20, 28, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
}

.reel-action-circle.active {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #ffffff;
}

.reel-action-label {
  font-size: 11px;
  font-weight: 600;
  color: #f1f5f9;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Indicateur de Défilement "Swipe pour le suivant" */
.scroll-hint {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.04em;
  z-index: 15;
  pointer-events: none;
  animation: pulseHint 2.5s infinite;
}

@keyframes pulseHint {
  0%, 100% { opacity: 0.8; transform: translate(-50%, 0); }
  50% { opacity: 0.3; transform: translate(-50%, 4px); }
}

/* Bottom Sheet / Tiroir de Commentaires Coulissant (Instagram Style) */
.bottom-sheet {
  position: absolute;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.sheet-panel {
  background: #12141c;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  border-top: 1px solid var(--border-glass);
  max-height: 75vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.8);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-header {
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
}

.sheet-drag-handle {
  width: 36px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
}

.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.sheet-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  background: #181b25;
}

/* Navigation Basse Dock Mobile Native */
.bottom-dock {
  height: var(--bottom-nav-height);
  background: rgba(12, 14, 20, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 10px;
  position: sticky;
  bottom: 0;
  z-index: 50;
  flex-shrink: 0;
}

.dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  transition: all 0.2s ease;
}

.dock-item.active {
  color: #ffffff;
}

.dock-item.active svg {
  filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.6));
}

/* Bouton Créer (+) Vibrant Central */
.create-btn-glow {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px var(--accent-glow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.create-btn-glow:hover, .create-btn-glow:active {
  transform: scale(1.1);
  box-shadow: 0 0 28px rgba(236, 72, 153, 0.6);
}

/* Modal de Création Multi-Format (Photo, Vidéo, Audio, Texte) */
.creator-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

@media (min-width: 641px) {
  .creator-modal-backdrop {
    align-items: center;
  }
}

.creator-modal-card {
  width: 100%;
  max-width: var(--max-app-width);
  background: #141722;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glass);
  padding: 24px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
}

.format-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.format-tab-btn {
  padding: 8px 0;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.format-tab-btn.active {
  background: var(--bg-surface-elevated);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.creator-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: #ffffff;
  padding: 14px;
  font-size: 15px;
  line-height: 1.5;
  outline: none;
  font-family: inherit;
  resize: vertical;
}

.creator-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.file-dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
  transition: all 0.2s ease;
}

.file-dropzone:hover {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.05);
}

.btn-primary-gradient {
  background: var(--accent-gradient);
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 20px var(--accent-glow);
  width: 100%;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn-primary-gradient:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-primary-gradient:active {
  transform: translateY(1px);
}

/* Utilitaires */
.badge-live {
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

[x-cloak] {
  display: none !important;
}
