/* ==========================================================================
   PixelSynth Style System (Vanilla CSS Cyberpunk Synthwave)
   ========================================================================== */

/* Design Tokens & Theme Variables */
:root {
  --font-family-title: 'Outfit', sans-serif;
  --font-family-body: 'Plus Jakarta Sans', sans-serif;

  /* Color Palette (Deep Space Cyberpunk) */
  --bg-deep: #080710;
  --bg-card: rgba(16, 15, 30, 0.7);
  --bg-card-hover: rgba(22, 20, 42, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(255, 255, 255, 0.18);

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #1f2937;

  /* Neon Accent Colors */
  --primary: #8b5cf6;
  /* Indigo/Violet */
  --accent: #06b6d4;
  /* Cyan */
  --danger: #ef4444;
  /* Red */

  /* Neon Swatches for Cells */
  --neon-purple: #a855f7;
  --neon-purple-gradient: linear-gradient(135deg, #a855f7, #6366f1);
  --neon-cyan: #06b6d4;
  --neon-cyan-gradient: linear-gradient(135deg, #06b6d4, #0ea5e9);
  --neon-green: #10b981;
  --neon-green-gradient: linear-gradient(135deg, #10b981, #22c55e);
  --neon-orange: #f97316;
  --neon-orange-gradient: linear-gradient(135deg, #f97316, #f43f5e);
  --neon-pink: #ec4899;
  --neon-pink-gradient: linear-gradient(135deg, #ec4899, #d946ef);
  --neon-yellow: #eab308;
  --neon-yellow-gradient: linear-gradient(135deg, #eab308, #e11d48);

  /* Shadow Glows */
  --glow-primary: 0 0 15px rgba(139, 92, 246, 0.5);
  --glow-accent: 0 0 15px rgba(6, 182, 212, 0.5);

  /* Animation Speeds */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Grid & Modal Defaults (Dark mode) */
  --cell-bg: rgba(255, 255, 255, 0.03);
  --cell-border: rgba(255, 255, 255, 0.04);
  --cell-hover-bg: rgba(255, 255, 255, 0.12);
  --cell-hover-border: rgba(255, 255, 255, 0.2);
  --modal-bg: rgba(15, 14, 28, 0.95);
  --input-bg: rgba(255, 255, 255, 0.03);
}

/* Light Theme Variables */
body.light {
  --bg-deep: #f1f5f9; /* Slate 100 */
  --bg-card: rgba(255, 255, 255, 0.7);
  --bg-card-hover: rgba(255, 255, 255, 0.85);
  --border-color: rgba(0, 0, 0, 0.08);
  --border-color-hover: rgba(0, 0, 0, 0.16);

  --text-main: #0f172a; /* Slate 900 */
  --text-muted: #64748b; /* Slate 500 */
  --text-dark: #f8fafc; /* Slate 50 */
  
  --cell-bg: rgba(0, 0, 0, 0.04);
  --cell-border: rgba(0, 0, 0, 0.06);
  --cell-hover-bg: rgba(0, 0, 0, 0.1);
  --cell-hover-border: rgba(0, 0, 0, 0.18);
  --modal-bg: rgba(255, 255, 255, 0.96);
  --input-bg: rgba(0, 0, 0, 0.03);
}

body.light .bg-glow {
  opacity: 0.35;
}

body.light .modal-form select option {
  background-color: #ffffff;
  color: #0f172a;
}

/* Global resets & scrollbars */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-family-body);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Background gradient blobs */
.bg-glow {
  position: fixed;
  top: -10%;
  left: -10%;
  width: 120vw;
  height: 120vh;
  background:
    radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(6, 182, 212, 0.1) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(236, 72, 153, 0.05) 0%, transparent 50%);
  z-index: -1;
  pointer-events: none;
}

/* Scrollbar styles */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* ==========================================================================
   Header Section
   ========================================================================== */
.app-header {
  background: rgba(8, 7, 16, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-family: var(--font-family-title);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.02);
  transition: var(--transition-fast);
}

.back-btn svg {
  width: 16px;
  height: 16px;
  transition: transform var(--transition-fast);
}

.back-btn:hover {
  color: var(--text-main);
  border-color: var(--accent);
  background: rgba(6, 182, 212, 0.08);
}

.back-btn:hover svg {
  transform: translateX(-4px);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-pulse {
  width: 10px;
  height: 10px;
  background-color: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent);
  animation: logo-glow 2s infinite alternate;
}

@keyframes logo-glow {
  0% {
    transform: scale(0.9);
    opacity: 0.5;
    box-shadow: 0 0 4px var(--accent);
  }

  100% {
    transform: scale(1.2);
    opacity: 1;
    box-shadow: 0 0 12px var(--accent);
  }
}

.logo-area h1 {
  font-family: var(--font-family-title);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.logo-area .highlight {
  color: transparent;
  background: linear-gradient(to right, var(--primary), #a855f7);
  background-clip: text;
  -webkit-background-clip: text;
}

.logo-area .badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #c084fc;
  padding: 0.2rem 0.5rem;
  border-radius: 100px;
  letter-spacing: 0.5px;
}

.stats-container {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.stat-bubble {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-val {
  font-family: var(--font-family-title);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--accent);
  text-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

/* ==========================================================================
   Main Layout Container
   ========================================================================== */
.app-container {
  max-width: 1600px;
  margin: 1.5rem auto;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 2rem;
  height: calc(100vh - 110px);
}

/* ==========================================================================
   Left Sidebar Panel
   ========================================================================== */
.sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.control-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem;
  transition: border-color var(--transition-normal), background-color var(--transition-normal);
}

.control-card:hover {
  border-color: var(--border-color-hover);
  background: var(--bg-card-hover);
}

.control-card h3 {
  font-family: var(--font-family-title);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Visualizer Card Styling */
.visualizer-container {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  height: 90px;
  overflow: hidden;
  position: relative;
  margin-bottom: 1rem;
}

#audio-visualizer {
  width: 100%;
  height: 100%;
  display: block;
}

.master-volume-control {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.volume-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Input Range Styling */
.range-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Switch toggles */
.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.switch-container {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}

.switch-container input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 34px;
  transition: var(--transition-normal);
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: var(--transition-normal);
}

.switch-container input:checked+.switch-slider {
  background-color: var(--primary);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

.switch-container input:checked+.switch-slider:before {
  transform: translateX(22px);
}

.control-row {
  margin-bottom: 1rem;
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.slider-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sequencer-controls {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

/* Mode toggles and grid buttons */
.tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.tools-grid button {
  justify-content: center;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

.w-full {
  width: 100%;
}

.tools-grid .w-full {
  grid-column: span 2;
}

/* Instructions card styling */
.instructions-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.instructions-list li strong {
  color: var(--text-main);
  display: inline-block;
  margin-right: 0.25rem;
}

/* ==========================================================================
   Right Grid Panel
   ========================================================================== */
.grid-panel {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  position: relative;
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Audio activation overlay */
.auth-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(8, 7, 16, 0.95);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 2rem;
  text-align: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.auth-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-content {
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.auth-icon {
  font-size: 3.5rem;
  animation: bounce 2s infinite;
  text-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
}

@keyframes bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

.auth-content h2 {
  font-family: var(--font-family-title);
  font-size: 1.8rem;
  font-weight: 700;
}

.auth-content p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Grid Scroll wrapper */
.grid-scroll-wrapper {
  flex: 1;
  overflow: auto;
  padding: 1.5rem;
  display: flex;
}

.grid-canvas-container {
  position: relative;
  border-radius: 8px;
  padding: 6px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
  margin: auto;
}

/* Sequencer Playhead */
.grid-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: linear-gradient(180deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 15px var(--accent), 0 0 4px var(--accent);
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.grid-playhead.active {
  opacity: 1;
}

/* Sound Grid rendering */
.pixel-grid {
  display: grid;
  gap: var(--grid-gap, 1px);
  user-select: none;
  -webkit-user-drag: none;
}

/* Cell styles */
.grid-cell {
  width: var(--cell-size, 10px);
  height: var(--cell-size, 10px);
  border-radius: calc(var(--cell-size, 10px) / 8);
  background: var(--cell-bg, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--cell-border, rgba(255, 255, 255, 0.04));
  cursor: crosshair;
  position: relative;
  transition: transform 0.15s cubic-bezier(0.1, 0.8, 0.3, 1), background-color 0.2s ease, border-color 0.2s ease;
}

/* Empty Cell Hover */
.grid-cell:not(.occupied):hover {
  background: var(--cell-hover-bg, rgba(255, 255, 255, 0.12));
  border-color: var(--cell-hover-border, rgba(255, 255, 255, 0.2));
  transform: scale(1.15);
  z-index: 5;
}

/* Hover effect active trail */
.grid-cell.active-trail {
  animation: cell-flash 0.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes cell-flash {
  0% {
    background-color: var(--accent);
    box-shadow: 0 0 15px var(--accent);
    transform: scale(1.25);
    z-index: 5;
  }

  100% {
    transform: scale(1);
    z-index: 1;
  }
}

/* Occupied cells */
.grid-cell.occupied {
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--emoji-size, 0.48rem);
  color: white;
}

.grid-cell.occupied:hover {
  transform: scale(1.28);
  z-index: 8;
  box-shadow: 0 0 18px currentColor !important;
}

/* Sequencer Scanning hit animation */
.grid-cell.seq-hit {
  animation: seq-flash 0.6s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes seq-flash {
  0% {
    box-shadow: 0 0 25px #ffffff, 0 0 10px #ffffff;
    filter: brightness(2);
    transform: scale(1.2);
    z-index: 6;
  }

  100% {
    filter: brightness(1);
    transform: scale(1);
    z-index: 1;
  }
}

/* Occupied Themes styling */
.grid-cell.theme-purple {
  background: var(--neon-purple-gradient);
  box-shadow: 0 0 6px rgba(168, 85, 247, 0.35);
  color: rgba(168, 85, 247, 1);
}

.grid-cell.theme-cyan {
  background: var(--neon-cyan-gradient);
  box-shadow: 0 0 6px rgba(6, 182, 212, 0.35);
  color: rgba(6, 182, 212, 1);
}

.grid-cell.theme-green {
  background: var(--neon-green-gradient);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.35);
  color: rgba(16, 185, 129, 1);
}

.grid-cell.theme-orange {
  background: var(--neon-orange-gradient);
  box-shadow: 0 0 6px rgba(249, 115, 22, 0.35);
  color: rgba(249, 115, 22, 1);
}

.grid-cell.theme-pink {
  background: var(--neon-pink-gradient);
  box-shadow: 0 0 6px rgba(236, 72, 153, 0.35);
  color: rgba(236, 72, 153, 1);
}

.grid-cell.theme-yellow {
  background: var(--neon-yellow-gradient);
  box-shadow: 0 0 6px rgba(234, 179, 8, 0.35);
  color: rgba(234, 179, 8, 1);
}

/* Cell Floating Tooltip details */
.cell-tooltip {
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(8, 7, 16, 0.95);
  border: 1px solid var(--border-color-hover);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  width: 180px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), var(--glow-primary);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  z-index: 100;
  text-align: left;
}

.grid-cell:hover .cell-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.tooltip-title {
  font-family: var(--font-family-title);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-main);
  margin-bottom: 0.2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tooltip-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.3;
  margin-bottom: 0.4rem;
  display: block;
  word-break: break-word;
}

.tooltip-sound {
  font-size: 0.7rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* ==========================================================================
   Buttons and Forms
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-family-title);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
  justify-content: center;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
  background: #7c3aed;
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(139, 92, 246, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-color-hover);
}

.btn-secondary.active-mode {
  border-color: var(--accent);
  background: rgba(6, 182, 212, 0.1);
  color: var(--accent);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.15);
}

.btn-danger {
  background: var(--danger);
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
  background: #dc2626;
  box-shadow: 0 4px 18px rgba(239, 68, 68, 0.4);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-muted);
}

.btn-outline:hover {
  border-color: var(--text-main);
  color: var(--text-main);
}

.btn-lg {
  padding: 0.8rem 1.6rem;
  font-size: 1.05rem;
  border-radius: 10px;
}

/* ==========================================================================
   Modals system
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(4, 3, 10, 0.7);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
  overflow-y: auto; /* Permet le défilement si le contenu dépasse l'écran */
}

.modal-content {
  background: var(--modal-bg, rgba(15, 14, 28, 0.95));
  border: 1px solid var(--border-color);
  border-radius: 20px;
  width: 100%;
  max-width: 580px;
  padding: 2rem;
  position: relative;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), var(--glow-primary);
  animation: modal-enter 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.15) forwards;
}



@keyframes modal-enter {
  0% {
    transform: scale(0.9) translateY(10px);
    opacity: 0;
  }

  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-header {
  margin-bottom: 1.5rem;
}

.modal-header h2 {
  font-family: var(--font-family-title);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.modal-cell-coord {
  color: var(--accent);
}

.modal-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.form-row.split {
  display: grid;
  grid-template-columns: 3.5fr 1.5fr;
  gap: 1rem;
}

/* Inputs styling */
.modal-form input[type="text"],
.modal-form input[type="password"],
.modal-form input[type="email"],
.modal-form input[type="url"],
.modal-form select {
  background: var(--input-bg, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.7rem 1rem;
  color: var(--text-main);
  font-family: var(--font-family-body);
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

.modal-form input[type="text"]:focus,
.modal-form input[type="password"]:focus,
.modal-form input[type="email"]:focus,
.modal-form input[type="url"]:focus,
.modal-form select:focus {
  border-color: var(--primary);
  outline: none;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}

.modal-form select option {
  background-color: #151428; /* Couleur sombre solide pour les options du menu déroulant */
  color: var(--text-main);
}

/* Color swatch grid */
.color-picker-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  margin-top: 0.2rem;
}

.color-swatch-label {
  cursor: pointer;
  position: relative;
  aspect-ratio: 1/1;
}

.color-swatch-label input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.swatch-design {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 8px;
  border: 2px solid transparent;
  transition: var(--transition-fast);
}

.color-swatch-label.purple .swatch-design {
  background: var(--neon-purple-gradient);
}

.color-swatch-label.cyan .swatch-design {
  background: var(--neon-cyan-gradient);
}

.color-swatch-label.green .swatch-design {
  background: var(--neon-green-gradient);
}

.color-swatch-label.orange .swatch-design {
  background: var(--neon-orange-gradient);
}

.color-swatch-label.pink .swatch-design {
  background: var(--neon-pink-gradient);
}

.color-swatch-label.yellow .swatch-design {
  background: var(--neon-yellow-gradient);
}

/* Color selected styling */
.color-swatch-label input:checked+.swatch-design {
  transform: scale(1.1);
  border-color: white;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.25);
}

/* Tabs System inside modal */
.tabs-navigation {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1rem;
  gap: 0.5rem;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-family-title);
  font-weight: 500;
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-pane {
  display: none;
  animation: tab-enter 0.2s ease forwards;
}

.tab-pane.active {
  display: block;
}

@keyframes tab-enter {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tab-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

/* Custom recording layouts */
.custom-audio-modes {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.custom-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 0.85rem;
}

.custom-card h5 {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.record-controls-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.rec-dot {
  width: 8px;
  height: 8px;
  background-color: var(--danger);
  border-radius: 50%;
  display: inline-block;
}

.recording-status {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.audio-mini-preview {
  margin-top: 0.75rem;
  width: 100%;
  height: 32px;
}

.file-upload-wrapper input {
  font-size: 0.8rem;
}

/* Submit Actions */
.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
}

.right-actions {
  display: flex;
  gap: 0.75rem;
  margin-left: auto;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1200px) {
  .app-container {
    grid-template-columns: 1fr;
    height: auto;
    overflow-y: visible;
  }

  .sidebar-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    overflow-y: visible;
    padding-right: 0;
  }

  .visualizer-card,
  .instructions-card {
    grid-column: span 1;
  }

  .sequencer-card,
  .tools-card {
    grid-column: span 1;
  }

  .grid-panel {
    height: 600px;
  }
}

@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .stats-container {
    width: 100%;
    justify-content: space-between;
  }

  .app-container {
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    height: auto;
  }

  .grid-panel {
    order: 1;
    height: 380px;
  }

  .sidebar-panel {
    order: 2;
    grid-template-columns: 1fr;
  }

  .visualizer-card,
  .sequencer-card,
  .tools-card,
  .instructions-card {
    grid-column: span 1;
  }

  .modal-overlay {
    align-items: flex-start;
    padding: 1rem;
  }

  .modal-content {
    padding: 1.25rem;
    margin-top: 1rem;
    margin-bottom: 3rem; /* Espace en bas pour ne pas cacher le bouton enregistrer sur mobile */
  }

  .form-row.split {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .right-actions {
    width: 100%;
  }

  .right-actions button {
    flex: 1;
  }

  .btn-danger.btn-outline {
    width: 100%;
  }

}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

/* Cell Owner Display in Modal */
.modal-cell-owner-info {
  font-size: 0.75rem;
  margin-top: 0.4rem;
  color: var(--text-muted);
}
.modal-cell-owner-info strong {
  color: var(--accent);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast-message {
  background: var(--modal-bg, rgba(15, 14, 28, 0.95));
  border: 1px solid var(--border-color-hover);
  border-left: 4px solid var(--accent);
  color: var(--text-main);
  padding: 0.8rem 1.2rem;
  border-radius: 8px;
  font-family: var(--font-family-body);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: toast-enter 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.15) forwards;
  min-width: 250px;
}

.toast-message.toast-error {
  border-left-color: var(--danger);
}

.toast-message.toast-success {
  border-left-color: var(--neon-green);
}

@keyframes toast-enter {
  from { transform: translateX(50px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-message.toast-exit {
  animation: toast-exit-anim 0.3s ease forwards;
}

@keyframes toast-exit-anim {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100px); opacity: 0; }
}

/* ==========================================================================
   Theme Toggle Switch (Uiverse.io)
   ========================================================================== */
.toggle-switch-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-switch {
  position: relative;
  width: 70px;
  height: 35px;
  --light: #d8dbe0;
  --dark: #1b1a2e;
}

.switch-label {
  position: absolute;
  width: 100%;
  height: 35px;
  background-color: var(--dark);
  border-radius: 20px;
  cursor: pointer;
  border: 2px solid var(--dark);
}

.checkbox {
  position: absolute;
  display: none;
}

.slider {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 20px;
  transition: 0.3s;
  pointer-events: none;
}

.checkbox:checked ~ .slider {
  background-color: var(--light);
}

.slider::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 6px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  box-shadow: inset 9px -3px 0px 0px var(--light);
  background-color: var(--dark);
  transition: 0.3s;
}

.checkbox:checked ~ .slider::before {
  transform: translateX(35px);
  background-color: #f59e0b; /* Glowing orange/yellow sun color */
  box-shadow: none;
}

/* ==========================================================================
   Zoom Controls
   ========================================================================== */
.zoom-controls-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.zoom-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#zoom-level-val {
  font-family: var(--font-family-title);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 45px;
  text-align: center;
}