/* index.css */

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica,
    Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: #0b0d12;
  color: #e7eaf0;
  overflow: hidden; /* app-like layout */
}

/* -----------------------------
   App Shell
------------------------------ */
.app {
    height: 100vh;
    display: grid;
    grid-template-columns: 360px 1fr; /* sidebar + editor */
    grid-template-rows: 56px 1fr 56px;
    grid-template-areas:
      "topbar topbar"
      "sidebar editor"
      "player  player";
    background: #0b0d12;
  }
  
  

/* -----------------------------
   Top Bar
------------------------------ */
.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(9, 11, 16, 0.9);
  backdrop-filter: blur(8px);
}

.topbar-left,
.topbar-center,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #e7eaf0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.07);
}

.project-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
  color: rgba(231, 234, 240, 0.9);
}

.project-pill .muted {
  color: rgba(231, 234, 240, 0.55);
}

.credit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: rgba(231, 234, 240, 0.75);
}

.btn {
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #e7eaf0;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.07);
}

.btn.primary {
  background: #ffffff;
  color: #0b0d12;
  border-color: transparent;
}

.btn.primary:hover {
  filter: brightness(0.95);
}


/* -----------------------------
   Sidebar (Edit Speech panel)
------------------------------ */
/* Sidebar base */
.sidebar {
  grid-area: sidebar;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(9, 11, 16, 0.75);
  overflow: hidden;

  display: grid;
  grid-template-columns: 56px 1fr; /* rail + content */
  min-height: 0; /* IMPORTANT: allow child scrolling */
}

  
  /* Rail (always exists, but shown/used mainly when collapsed) */
  .sidebar-rail {
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(9, 11, 16, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 8px;
    gap: 10px;
  }
  
  .rail-btn {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: grid;
    place-items: center;
  
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(231, 234, 240, 0.9);
    cursor: pointer;
    font: inherit;
    padding: 0;
  }
  
  .rail-btn:hover {
    background: rgba(255, 255, 255, 0.07);
  }
  
  /* Expanded content wrapper */
  .sidebar-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;   /* IMPORTANT */
}

  
  /* Collapsed state: sidebar shrinks to rail width and hides content */
  .app.sidebar-collapsed {
    grid-template-columns: 56px 1fr; /* sidebar (collapsed) + editor */
  }
  
  .app.sidebar-collapsed .sidebar {
    grid-template-columns: 56px; /* only rail */
  }
  
  .app.sidebar-collapsed .sidebar-content {
    display: none;
  }
  

.sidebar-header {
  padding: 14px 14px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-header h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.panel {
  padding: 14px;
  flex: 1;              /* fill vertical space */
  overflow-y: auto;     /* vertical scroll only */
  min-height: 0;        /* REQUIRED inside flex */
}


.group {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.group:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.label {
  font-size: 12px;
  font-weight: 700;
  color: rgba(231, 234, 240, 0.7);
  margin-bottom: 8px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.subtext {
  font-size: 12px;
  color: rgba(231, 234, 240, 0.55);
  line-height: 1.25;
}

/* Inputs */
.range {
  width: 100%;
  accent-color: #ffffff;
}

.select,
.input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e7eaf0;
  padding: 10px 10px;
  border-radius: 12px;
  outline: none;
  font-size: 13px;
}

.select:focus,
.input:focus {
  border-color: rgba(255, 255, 255, 0.18);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: rgba(231, 234, 240, 0.75);
}

.switch {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  cursor: pointer;
  flex: 0 0 auto;
}

.switch::after {
  content: "";
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  position: absolute;
  top: 50%;
  left: 3px;
  transform: translateY(-50%);
  transition: left 160ms ease, background 160ms ease;
}

.switch.on {
  background: rgba(255, 255, 255, 0.2);
}

.switch.on::after {
  left: 21px;
}

/* AI Tools cards */
.tool-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.tool-card:hover {
  background: rgba(255, 255, 255, 0.05);
}

.tool-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  color: rgba(231, 234, 240, 0.9);
}

.tool-card h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
}

.tool-card p {
  margin: 4px 0 0;
  font-size: 12px;
  color: rgba(231, 234, 240, 0.6);
  line-height: 1.25;
}

/* -----------------------------
   Editor (speaker panel + text editor)
------------------------------ */
.editor {
  grid-area: editor;
  position: relative;
  overflow: hidden;
  background: radial-gradient(
      900px 500px at 40% -10%,
      rgba(255, 255, 255, 0.07),
      transparent 60%
    ),
    rgba(9, 11, 16, 0.5);
}

.editor-actions {
  position: absolute;
  top: 12px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 5;
}

.chip {
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
  font-weight: 700;
  color: rgba(231, 234, 240, 0.85);
  cursor: pointer;
}

.chip:hover {
  background: rgba(255, 255, 255, 0.06);
}

.editor-split {
  height: 100%;
  display: grid;
  grid-template-columns: 64px 1fr;
  overflow: hidden;
}

.texteditor {
  overflow-y: auto;
}


.section-line {
  position: absolute;
  right: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 1px;
  pointer-events: none;
}



/* Speaker rail rows */
.speaker-rail {
    position: relative;
    background: rgba(9, 11, 16, 0.45);
    padding-top: 0;            /* IMPORTANT: remove guessed padding */
    overflow: hidden;          /* keep clean edges */
  }


  
  /* Bubbles are positioned by JS */
  .speaker-bubble {
    position: absolute;
    left: 50%;
    top: 0;                    /* JS sets this */
    transform: translate(-50%, 0);
  
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: grid;
    place-items: center;
  
    font-size: 13px;
    font-weight: 800;
  
    background: rgba(255, 255, 255, 0.08);
    color: rgba(231, 234, 240, 0.85);
  
    opacity: 0;
    transition:
      opacity 140ms ease,
      transform 140ms ease,
      background 120ms ease;
  
    cursor: pointer;
    pointer-events: auto;      /* IMPORTANT: allow clicks */
  }
  
  /* Hover/selected behavior (same as you had) */
  .speaker-bubble:hover {
    opacity: 1;
    transform: translate(-50%, 0) translateX(-8px) scale(1);
  }
  
  .speaker-bubble.selected {
    opacity: 1;
    transform: translate(-50%, 0) translateX(0px) scale(1);
    background: rgba(170, 70, 255, 0.85);
    color: #fff;
  }
  

/* Text area */
.texteditor {
  height: 100%;
  overflow: auto;

  /* add extra top space for floating editor actions */
  padding: 72px 18px 24px;
}


.h1 {
  margin: 0 0 14px;
  font-size: 20px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.9);
}

.h2 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 800;
  color: rgba(231, 234, 240, 0.9);
}

/* Script rows */
.script {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.script-row {
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.script-row:hover .txt {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
}

.section-line.has-audio {
  background: #ffffff;
}

.script-row.selected .txt {
  background: rgba(170, 70, 255, 0.14);
  outline: 1px solid rgba(170, 70, 255, 0.25);
  border-radius: 6px;
}



.txt {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: #ffffff;
}


/* Scrollbars (webkit) */
.texteditor::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}
.texteditor::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.10);
  border-radius: 999px;
}
.texteditor::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

/* -----------------------------
   Player Bar (was Timeline)
------------------------------ */
.timeline {
  grid-area: player;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(9, 11, 16, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Centered transport row */
.floating-player {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* IMPORTANT: scope player sizing so topbar/nav icon-btns stay 34x34 */
.timeline .icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
}

/* White ElevenLabs-style play button */
.timeline .play {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: #ffffff;
  color: #0b0d12;
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.timeline .play:hover {
  filter: brightness(0.92);
}

/* Pill speed + timecode */
.timeline .speed {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
  color: rgba(231, 234, 240, 0.8);
}

.timeline .timecode {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: rgba(231, 234, 240, 0.75);
}

/* ---- Legacy timeline bits kept (unrelated), but harmless if not in DOM ---- */
.timeline-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.player {
  display: flex;
  align-items: center;
  gap: 14px;
}

.clips {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  overflow: auto;
  padding-bottom: 6px;
}

.clip {
  flex: 0 0 auto;
  height: 52px;
  min-width: 110px;
  border-radius: 12px;
  border: 1px solid rgba(170, 70, 255, 0.22);
  background: rgba(170, 70, 255, 0.14);
  position: relative;
  cursor: pointer;
}

.clip::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 10px;
  background: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.08) 6px,
    transparent 6px,
    transparent 12px
  );
  opacity: 0.35;
}

.clip.selected {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 1px;
}

.zoom {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(231, 234, 240, 0.6);
  font-size: 12px;
}
/* =============================
   Empty State (No Text Yet)
============================= */

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}

.empty-center {
  max-width: 640px;
  opacity: 0.75;
}

.empty-center h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: rgba(231, 234, 240, 0.6);
  line-height: 1.6;
}

.empty-actions {
  margin-top: 28px;
  display: flex;
  gap: 14px;
  justify-content: center;
}

.empty-actions .btn {
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
}

.empty-actions .btn:hover {
  background: rgba(255, 255, 255, 0.08);
}


/* -----------------------------
   Utility
------------------------------ */
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
}

.muted {
  color: rgba(231, 234, 240, 0.55);
}

/* Scrollbars (webkit) */
.editor-inner::-webkit-scrollbar,
.panel::-webkit-scrollbar,
.clips::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

.editor-inner::-webkit-scrollbar-thumb,
.panel::-webkit-scrollbar-thumb,
.clips::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.10);
  border-radius: 999px;
}

.editor-inner::-webkit-scrollbar-track,
.panel::-webkit-scrollbar-track,
.clips::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

/* -----------------------------
   Responsive (basic)
------------------------------ */
@media (max-width: 1100px) {
    .app {
      grid-template-columns: 320px 1fr;
    }
    .app.sidebar-collapsed {
      grid-template-columns: 56px 1fr;
    }
  }
  
@media (max-width: 960px) {
  body { overflow: auto; }

  .app {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    grid-template-rows: 56px auto auto 56px;
    grid-template-areas:
      "topbar"
      "editor"
      "sidebar"
      "player";
  }



  /* collapsed on mobile: hide sidebar row */
/* collapsed on mobile: keep rail visible (do NOT remove sidebar row) */
.app.sidebar-collapsed {
  grid-template-rows: 56px auto 60px 56px; /* sidebar row becomes rail height */
}

.app.sidebar-collapsed .sidebar {
  max-height: 60px;          /* rail padding(10+10) + btn(40) */
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.06); /* keep divider if you want */
  grid-template-columns: 56px; /* rail only */
}

.app.sidebar-collapsed .sidebar-content {
  display: none;
}

 
  /* In mobile layout the footer may not be in the grid; keep it styled consistently */
  .timeline {
    grid-area: player;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(9, 11, 16, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
  }
}

.txt:focus {
  outline: none;
}
/* =============================
   Voice Cloning (Unified Style)
============================= */

.voice-clone-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  cursor:pointer;
  margin-bottom:12px;
}

.voice-clone-chevron{
  font-size:12px;
  transition:transform 160ms ease;
  opacity:0.6;
}

.voice-clone-collapsed .voice-clone-chevron{
  transform:rotate(-90deg);
}

.voice-clone-collapsed #voiceCloneBody{
  display:none;
}

/* Drop zone — simplified to match sidebar */
.voice-drop-zone{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:4px;

  padding:18px;
  border-radius:12px;

  border:1px dashed rgba(255,255,255,0.15);
  background:rgba(255,255,255,0.03);

  transition:border-color 140ms ease, background 140ms ease;
  cursor:pointer;
}

.voice-drop-zone:hover{
  border-color:rgba(255,255,255,0.3);
  background:rgba(255,255,255,0.05);
}

.drop-title{
  font-size:13px;
  font-weight:600;
}

.drop-sub{
  font-size:12px;
  color:rgba(231,234,240,0.6);
}

.drop-hint{
  font-size:11px;
  color:rgba(231,234,240,0.45);
}

.drop-feedback{
  margin-top:6px;
  font-size:12px;
  min-height:16px;
  color:rgba(231,234,240,0.6);
}

.clone-picked{
  flex:1;
  font-size:12px;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,0.08);
  background:rgba(255,255,255,0.03);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

#voiceCloneConfirm:disabled{
  opacity:0.55;
  cursor:not-allowed;
}
.drop-hint{
  margin-top: 2px;
  font-size: 11px;
  color: rgba(231,234,240,0.45);
  text-align: center;
}

/* Make the name input feel like part of the card */
#voiceCloneName.select{
  background: rgba(255,255,255,0.05);
}

.drop-feedback{
  margin-top: 10px;
  font-size: 12px;
  color: rgba(231,234,240,0.65);
  min-height: 16px; /* keeps layout stable */
}

.voice-drop-zone.is-uploading{
  border-style: solid;
  border-color: rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.07);
}

.voice-drop-zone.is-success{
  border-style: solid;
  border-color: rgba(255,255,255,0.45);
  background: rgba(255,255,255,0.06);
}

.voice-drop-zone.is-error{
  border-style: solid;
  border-color: rgba(255,120,120,0.55);
  background: rgba(255,120,120,0.10);
}

.drop-feedback.is-error{
  color: rgba(255,160,160,0.95);
}

.drop-feedback.is-success{
  color: rgba(231,234,240,0.85);
}
.drop-feedback{
  margin-top: 10px;
  font-size: 12px;
  color: rgba(231,234,240,0.65);
  min-height: 16px;
}

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

.clone-picked{
  flex: 1;
  font-size: 12px;
  color: rgba(231,234,240,0.75);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#voiceCloneConfirm:disabled{
  opacity: 0.55;
  cursor: not-allowed;
  filter: saturate(0.7);
}
.voice-clone-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  font-size:12px;
  font-weight:700;
  color:rgba(231,234,240,0.7);
  margin-bottom:8px;
  cursor:pointer;
  user-select:none;
}

.voice-clone-header:hover{
  color:#fff;
}

.voice-clone-chevron{
  transition:transform 160ms ease;
}

.voice-clone-collapsed .voice-clone-chevron{
  transform:rotate(-90deg);
}

.voice-clone-collapsed #voiceCloneBody{
  display:none;
}
