/* ═══════════════════════════════════════════════════════════════════════
   CREATOR INTERFACE — Phase 1 MVP
   MyTunes Analog Platform
   2026-07-25

   Brand palette:
     Deep Space  #06030F
     Teal        #2DD4BF   — Melody's color
     Orange      #F97316   — action / CTA
     Purple      #8B5CF6   — depth / processing
   ═══════════════════════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────────────────────────────────
   CARBON BAND
   Full-width animated canvas at the top of #section-home.
   Bleeds to both edges of the content area.
   ────────────────────────────────────────────────────────────────────── */

.carbon-band-container {
  position: relative;
  width: calc(100% + 4rem);          /* bleed past the main-content padding */
  margin-left: -2rem;
  margin-right: -2rem;
  height: 80px;
  background: #06030F;
  overflow: hidden;
  margin-bottom: 2rem;
  flex-shrink: 0;
}

#carbon-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.carbon-band-vignette {
  position: absolute;
  inset: 0;
  /* Soft fade at bottom into page background */
  background: linear-gradient(
    to bottom,
    transparent 0%,
    transparent 55%,
    rgba(6, 3, 15, 0.55) 80%,
    rgba(6, 3, 15, 0.92) 100%
  );
  pointer-events: none;
  z-index: 2;
}

/* ──────────────────────────────────────────────────────────────────────
   CREATOR INTERFACE CONTAINER
   ────────────────────────────────────────────────────────────────────── */

.creator-interface-container {
  width: 100%;
  border-radius: 16px;
  border: 1.5px solid rgba(139, 92, 246, 0.45);
  background: linear-gradient(145deg, rgba(10, 6, 28, 0.97), rgba(16, 10, 42, 0.95));
  box-shadow:
    0 0 0 1px rgba(139, 92, 246, 0.08),
    0 8px 40px rgba(0, 0, 0, 0.6),
    0 0 60px rgba(139, 92, 246, 0.06);
  padding: 0;
  overflow: hidden;
  margin-bottom: 2rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Focus / active state — border shifts to Teal */
.creator-interface-container.ci-focused {
  border-color: rgba(45, 212, 191, 0.65);
  box-shadow:
    0 0 0 3px rgba(45, 212, 191, 0.08),
    0 8px 40px rgba(0, 0, 0, 0.6),
    0 0 60px rgba(45, 212, 191, 0.08);
}

/* Processing state — purple glow bleeds out */
.creator-interface-container.ci-processing {
  border-color: rgba(139, 92, 246, 0.75);
  box-shadow:
    0 0 0 4px rgba(139, 92, 246, 0.12),
    0 8px 40px rgba(0, 0, 0, 0.6),
    0 0 80px rgba(139, 92, 246, 0.15);
}

/* ──────────────────────────────────────────────────────────────────────
   MELODY STATUS BAR
   ────────────────────────────────────────────────────────────────────── */

.melody-status-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid rgba(139, 92, 246, 0.2);
  background: rgba(6, 3, 15, 0.4);
  user-select: none;
}

.melody-status-icon {
  font-size: 13px;
  color: #2DD4BF;
  font-weight: 700;
  letter-spacing: 0.5px;
  opacity: 0.9;
}

.melody-status-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #2DD4BF;
  text-transform: uppercase;
}

.melody-status-divider {
  width: 1px;
  height: 12px;
  background: rgba(45, 212, 191, 0.3);
  margin: 0 0.15rem;
}

.melody-status-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2.5px;
  color: rgba(45, 212, 191, 0.75);
  text-transform: uppercase;
  transition: color 0.4s ease;
  flex: 1;
}

/* State-specific label colors */
.melody-status-label[data-state="composing"] {
  color: rgba(139, 92, 246, 0.9);
}

.melody-status-label[data-state="done"] {
  color: rgba(45, 212, 191, 1);
}

.melody-status-label[data-state="error"] {
  color: rgba(239, 68, 68, 0.9);
}

/* Pulsing status dot */
.melody-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2DD4BF;
  animation: melody-dot-pulse 2.4s ease-in-out infinite;
  flex-shrink: 0;
  transition: background 0.4s ease;
}

.melody-status-dot[data-state="composing"] {
  background: #8B5CF6;
  animation: melody-dot-pulse-fast 0.9s ease-in-out infinite;
}

.melody-status-dot[data-state="done"] {
  background: #2DD4BF;
  animation: none;
  opacity: 1;
}

@keyframes melody-dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.85); }
}

@keyframes melody-dot-pulse-fast {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.3; transform: scale(0.7); }
}

/* ──────────────────────────────────────────────────────────────────────
   MELODY RESPONSE AREA
   ────────────────────────────────────────────────────────────────────── */

.melody-response {
  position: relative;
  margin: 1.25rem 1.25rem 0;
  border-radius: 12px;
  border: 1.5px solid rgba(139, 92, 246, 0.3);
  background: linear-gradient(145deg, rgba(8, 4, 28, 0.92), rgba(14, 9, 40, 0.88));
  min-height: 110px;
  max-height: 280px;
  overflow-y: auto;
  padding: 1rem 1.1rem;
  transition: border-color 0.35s ease;

  /* Scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: rgba(45, 212, 191, 0.2) transparent;
}

.melody-response::-webkit-scrollbar {
  width: 4px;
}
.melody-response::-webkit-scrollbar-track {
  background: transparent;
}
.melody-response::-webkit-scrollbar-thumb {
  background: rgba(45, 212, 191, 0.25);
  border-radius: 4px;
}

/* HUD-style corner accents (4 corners) */
.melody-response::before,
.melody-response::after,
.melody-response-corner-bl,
.melody-response-corner-br {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border-color: rgba(45, 212, 191, 0.4);
  border-style: solid;
  pointer-events: none;
  z-index: 1;
}

.melody-response::before {
  top: -1px; left: -1px;
  border-width: 2px 0 0 2px;
  border-radius: 2px 0 0 0;
}

.melody-response::after {
  top: -1px; right: -1px;
  border-width: 2px 2px 0 0;
  border-radius: 0 2px 0 0;
}

.melody-response-corner-bl {
  bottom: -1px; left: -1px;
  border-width: 0 0 2px 2px;
  border-radius: 0 0 0 2px;
}

.melody-response-corner-br {
  bottom: -1px; right: -1px;
  border-width: 0 2px 2px 0;
  border-radius: 0 0 2px 0;
}

/* Active / responding border */
.melody-response.ci-responding {
  border-color: rgba(45, 212, 191, 0.55);
}

/* Response text content */
.melody-response-text {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.65;
  color: rgba(225, 235, 255, 0.9);
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: color 0.3s ease, opacity 0.3s ease;
}

/* Idle ambient state */
.melody-response-text.ci-idle-text {
  color: rgba(180, 170, 220, 0.35);
  font-style: italic;
  font-size: 15px;
  letter-spacing: 0.3px;
}

/* Active message text */
.melody-response-text.ci-active-text {
  color: rgba(225, 235, 255, 0.92);
  font-style: normal;
  text-align: left;
  align-items: flex-start;
  justify-content: flex-start;
}

/* Blinking teal cursor */
.melody-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: #2DD4BF;
  margin-left: 2px;
  vertical-align: middle;
  animation: melody-cursor-blink 1s step-end infinite;
}

@keyframes melody-cursor-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ──────────────────────────────────────────────────────────────────────
   INPUT BAR
   ────────────────────────────────────────────────────────────────────── */

.creator-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 0.65rem;
  padding: 1rem 1.25rem 1.25rem;
  margin-top: 0.5rem;
}

/* Mic button */
.mic-button {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(139, 92, 246, 0.15);
  color: rgba(200, 190, 255, 0.6);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
  outline: none;
  position: relative;
  align-self: flex-end;
  margin-bottom: 2px;  /* optical align with textarea bottom */
}

.mic-button:hover {
  background: rgba(139, 92, 246, 0.28);
  color: rgba(200, 190, 255, 0.9);
}

.mic-button:focus-visible {
  box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.5);
}

/* Mic active state (Phase 2) */
.mic-button.mic-active {
  background: rgba(249, 115, 22, 0.25);
  color: #F97316;
  animation: mic-ring-expand 1.2s ease-out infinite;
}

@keyframes mic-ring-expand {
  0%   { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.5); }
  70%  { box-shadow: 0 0 0 10px rgba(249, 115, 22, 0); }
  100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0); }
}

/* Textarea wrapper */
.creator-input-wrap {
  flex: 1;
  position: relative;
}

/* Creator textarea */
.creator-input {
  width: 100%;
  min-height: 52px;
  max-height: 130px;
  border-radius: 12px;
  border: 1.5px solid rgba(139, 92, 246, 0.4);
  background: rgba(8, 5, 20, 0.7);
  color: rgba(225, 235, 255, 0.92);
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  padding: 0.85rem 1rem;
  resize: none;
  outline: none;
  box-sizing: border-box;
  transition:
    border-color 0.25s ease,
    box-shadow 0.25s ease,
    height 0.15s ease;
  overflow-y: auto;
  display: block;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 92, 246, 0.2) transparent;
}

.creator-input::placeholder {
  color: rgba(140, 130, 180, 0.5);
}

.creator-input:focus {
  border-color: rgba(45, 212, 191, 0.7);
  box-shadow:
    0 0 0 3px rgba(45, 212, 191, 0.1),
    0 0 28px rgba(45, 212, 191, 0.06);
}

.creator-input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Create button */
.create-btn {
  flex-shrink: 0;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #F97316 0%, #fb923c 100%);
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 0 1.4rem;
  height: 46px;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.2s ease;
  white-space: nowrap;
  outline: none;
  align-self: flex-end;
  margin-bottom: 1px;  /* optical align */
}

.create-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(249, 115, 22, 0.35);
}

.create-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

.create-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.create-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.4);
}

/* ──────────────────────────────────────────────────────────────────────
   RESPONSIVE — MOBILE
   ────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .carbon-band-container {
    height: 56px;
    width: calc(100% + 2rem);
    margin-left: -1rem;
    margin-right: -1rem;
    margin-bottom: 1.5rem;
  }

  .creator-interface-container {
    border-radius: 12px;
    margin-bottom: 1.5rem;
  }

  .melody-status-bar {
    padding: 0.65rem 1rem;
  }

  .melody-response {
    margin: 1rem 1rem 0;
    min-height: 80px;
    padding: 0.85rem 0.9rem;
  }

  .melody-response-text {
    font-size: 13px;
  }

  .creator-input-bar {
    padding: 0.75rem 1rem 1rem;
    gap: 0.5rem;
  }

  .creator-input {
    font-size: 14px;
    min-height: 46px;
    padding: 0.7rem 0.85rem;
  }

  .create-btn {
    height: 44px;
    padding: 0 1rem;
  }
}

@media (max-width: 480px) {
  .carbon-band-container {
    height: 48px;
    width: calc(100% + 1.5rem);
    margin-left: -0.75rem;
    margin-right: -0.75rem;
  }

  /* Icon-only Create button on very small screens */
  .create-btn .btn-label {
    display: none;
  }

  .create-btn .btn-icon {
    display: inline;
  }

  .create-btn {
    width: 46px;
    padding: 0;
    font-size: 18px;
  }
}

/* ──────────────────────────────────────────────────────────────────────
   ACCESSIBILITY — reduce motion
   ────────────────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .melody-status-dot {
    animation: none;
    opacity: 1;
  }
  .melody-cursor {
    animation: none;
    opacity: 1;
  }
  .mic-button.mic-active {
    animation: none;
  }
}
