/* =============================
    THEME VARIABLES
    ============================= */

:root {
  --bg-main: #121212;
  --bg-panel: #1a1a1a;
  --bg-header: #1f1f1f;

  --text-main: white;
  --text-secondary: #aaa;

  --accent: #8e2de2;

  --danger: #d32f2f;
  --disabled: #555;
}

.light-mode {
  --bg-main: #f5f5f5;
  --bg-panel: #ffffff;
  --bg-header: #e0e0e0;

  --text-main: #111;
  --text-secondary: #555;

  --accent: #6a0dad;

  --danger: #c62828;
  --disabled: #bbb;
}

/* =============================
    BASE
    ============================= */

body {
  margin: 0;

  background: var(--bg-main);

  color: var(--text-main);

  font-family: Arial, sans-serif;

  overflow: hidden;
}

/* =============================
    HEADER
    ============================= */

.main-header {
  background: var(--bg-header);

  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 15px 30px;
}

.header-title {
  font-size: 26px;
  font-weight: bold;
}

.theme-btn {
  background: var(--accent);

  border: none;

  padding: 8px 16px;

  border-radius: 6px;

  color: white;

  cursor: pointer;

  transition: 0.2s;
}

.theme-btn:hover {
  filter: brightness(1.15);
}

/* =============================
    MAIN LAYOUT
    ============================= */

.main {
  display: flex;

  height: calc(100vh - 70px);
}

/* =============================
    VIDEO PANEL
    ============================= */

.video-panel {
  width: 70%;

  padding: 20px;

  display: flex;
  flex-direction: column;

  box-sizing: border-box;
}

.video-container {
  position: relative;

  width: 100%;

  aspect-ratio: 16 / 9;

  background: black;

  border-radius: 10px;

  overflow: hidden;
}

video {
  width: 100%;
  height: 100%;

  display: none;
}

.placeholder {
  position: absolute;

  width: 100%;
  height: 100%;

  display: flex;

  align-items: center;
  justify-content: center;

  color: #777;

  font-size: 20px;
}

.file-name {
  position: absolute;

  top: 10px;
  left: 15px;

  background: rgba(0, 0, 0, 0.6);

  padding: 5px 10px;

  border-radius: 6px;

  font-size: 14px;
}

/* =============================
    FLOATING SUBTITLE OVERLAY
    ============================= */

.floating-subtitle {
  position: absolute;

  bottom: 8%;

  left: 50%;

  transform: translateX(-50%);

  max-width: 80%;

  text-align: center;

  font-size: 22px;

  color: white;

  background: rgba(0, 0, 0, 0.65);

  padding: 8px 16px;

  border-radius: 8px;

  opacity: 0;

  transition: opacity 0.2s ease;

  pointer-events: none;
}

/* =============================
    FILE BUTTON ROW
    ============================= */

.file-buttons {
  margin-top: 18px;

  display: flex;

  justify-content: center;

  align-items: center;

  gap: 15px;
}

/* =============================
    STANDARD BUTTON
    ============================= */

.purple-btn {
  background: var(--accent);

  border: none;

  padding: 10px 18px;

  border-radius: 8px;

  color: white;

  font-size: 15px;

  cursor: pointer;

  transition: 0.2s;
}

.purple-btn:hover {
  filter: brightness(1.15);
}

.purple-btn:active {
  transform: scale(0.96);
}

/* =============================
    STREAM MERGED INPUT
    ============================= */

.stream-group {
  display: flex;

  align-items: center;

  border-radius: 999px;

  overflow: hidden;

  border: 1px solid rgba(255, 255, 255, 0.18);

  background: rgba(255, 255, 255, 0.05);

  transition: 0.2s;
}

.stream-group:focus-within {
  border-color: var(--accent);

  box-shadow: 0 0 8px rgba(142, 45, 226, 0.4);
}

.stream-input {
  border: none;

  outline: none;

  padding: 10px 14px;

  width: 240px;

  background: transparent;

  color: var(--text-main);

  font-size: 14px;
}

.stream-input::placeholder {
  color: var(--text-secondary);
}

.stream-play-btn {
  border: none;

  padding: 10px 18px;

  background: var(--accent);

  color: white;

  cursor: pointer;

  transition: 0.2s;
}

.stream-play-btn:hover {
  filter: brightness(1.15);
}

/* =============================
    RESET BUTTON (CLEAR ALL)
    ============================= */

.reset-btn {
  padding: 10px 18px;

  border-radius: 8px;

  border: none;

  font-size: 15px;

  background: var(--disabled);

  color: #ccc;

  cursor: not-allowed;

  transition: 0.2s;
}

.reset-btn.active {
  background: var(--danger);

  color: white;

  cursor: pointer;
}

.reset-btn.active:hover {
  filter: brightness(1.15);
}

/* =============================
    SUBTITLE PANEL
    ============================= */

.subtitle-panel {
  width: 30%;

  background: var(--bg-panel);

  display: flex;

  flex-direction: column;
}

.subtitle-header {
  padding: 14px;

  font-size: 18px;

  font-weight: bold;

  border-bottom: 1px solid #333;
}

.subtitle-list {
  flex: 1;

  overflow-y: auto;

  padding: 12px;
}

.no-file {
  text-align: center;

  margin-top: 50px;

  color: var(--text-secondary);
}

.subtitle-item {
  padding: 10px;

  border-radius: 8px;

  margin-bottom: 6px;

  cursor: pointer;

  transition: 0.2s;
}

.subtitle-item:hover {
  background: rgba(142, 45, 226, 0.15);
}

.subtitle-item.active {
  background: rgba(142, 45, 226, 0.25);
}

/* =============================
    CONTROLS PANEL
    ============================= */

.controls-panel {
  padding: 16px;

  border-top: 1px solid #333;

  display: flex;

  flex-direction: column;

  align-items: center;
}

/* =============================
    SYNC BUTTON
    ============================= */

.sync-btn {
  width: 92%;
  max-width: 360px;

  padding: 10px;

  margin-bottom: 12px;

  border-radius: 12px;

  border: none;

  background: var(--accent);

  color: white;

  cursor: pointer;

  transition: 0.2s;
}

.sync-btn:hover {
  filter: brightness(1.2);
}

/* =============================
    SLIDERS
    ============================= */

.slider-group {
  width: 92%;

  margin-bottom: 14px;
}

.slider-group label {
  display: flex;

  justify-content: space-between;

  font-size: 13px;

  margin-bottom: 4px;
}

input[type="range"] {
  width: 100%;

  height: 4px;

  accent-color: var(--accent);

  cursor: pointer;
}

/* =============================
    VOICE SELECT
    ============================= */

select {
  width: 92%;

  padding: 7px;

  border-radius: 8px;

  border: none;

  background: rgba(0, 0, 0, 0.4);

  color: white;
}

/* =============================
    RESET TO DEFAULT BUTTON
    ============================= */

.reset-defaults-btn {
  width: 92%;
  max-width: 360px;

  padding: 10px;

  margin-top: 10px;

  border-radius: 12px;

  border: none;

  background: var(--disabled);

  color: #ccc;

  cursor: not-allowed;

  transition: 0.2s;
}

.reset-defaults-btn.active {
  background: var(--danger);

  color: white;

  cursor: pointer;
}

.reset-defaults-btn.active:hover {
  filter: brightness(1.15);
}
/* =============================
    MOBILE RESPONSIVE LAYOUT (FIXED)
    ============================= */

@media (max-width: 768px) {
  html,
  body {
    height: auto;
    overflow-y: auto;
  }

  .main {
    flex-direction: column;
    height: auto;
  }

  .video-panel {
    width: 100%;
    padding: 12px;
  }

  .subtitle-panel {
    width: 100%;

    height: 65vh;

    display: flex;

    flex-direction: column;

    flex-shrink: 0;
  }

  .subtitle-list {
    flex: 1;

    overflow-y: auto;
  }

  /* Button container becomes flexible grid */

  .file-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;

    width: 100%;
  }

  /* Add Video and Add Subs side-by-side */

  #addVideoBtn,
  #addSubtitleBtn {
    width: calc(50% - 5px);

    order: 1;
  }

  /* Stream group full width below */

  .stream-group {
    width: 100%;

    order: 2;
  }

  .stream-input {
    width: 100%;
    flex: 1;
  }

  /* Reset full width at bottom */

  #resetBtn {
    width: 100%;

    order: 3;
  }

  /* Floating subtitle adjustment */

  .floating-subtitle {
    font-size: 18px;

    bottom: 10%;

    max-width: 90%;
  }

  /* Controls full width */

  .sync-btn,
  .reset-defaults-btn,
  select,
  .slider-group {
    width: 95%;
    max-width: none;
  }

  /* Subtitle readability */

  .subtitle-item {
    font-size: 16px;
  }
}
