/* =============================================================
   MP4 -> MP3 Converter — styles
   All rules are scoped under #mp4mp3-app so this can be embedded
   inside another website (e.g. via shortcode) without breaking it.
   ============================================================= */

/* Minimal, safe reset — only applies when this file is opened as its
   own page. If only the #mp4mp3-app markup is embedded elsewhere via a
   shortcode, these two rules simply won't find matching elements to
   duplicate, so they never interfere with a host site's own body/html. */
html:has(> body > #mp4mp3-app), body:has(> #mp4mp3-app) {
  margin: 0;
  padding: 0;
}

#mp4mp3-app, #mp4mp3-app * {
  box-sizing: border-box;
}

#mp4mp3-app {
  --mp4mp3-bg: #0b0e17;
  --mp4mp3-bg-alt: #12162304;
  --mp4mp3-panel: rgba(255,255,255,0.045);
  --mp4mp3-panel-border: rgba(255,255,255,0.09);
  --mp4mp3-text: #f2f4fb;
  --mp4mp3-text-dim: #9aa2b8;
  --mp4mp3-accent: #7c5cff;
  --mp4mp3-accent-2: #29d6c8;
  --mp4mp3-accent-grad: linear-gradient(135deg,#7c5cff 0%,#29d6c8 100%);
  --mp4mp3-danger: #ff5c7a;
  --mp4mp3-success: #29d68a;
  --mp4mp3-warning: #ffb545;
  --mp4mp3-radius: 18px;
  --mp4mp3-radius-sm: 10px;
  --mp4mp3-shadow: 0 20px 50px rgba(0,0,0,0.35);

  position: relative;
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  font-family: "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  background: var(--mp4mp3-bg);
  color: var(--mp4mp3-text);
  overflow-x: hidden;
  isolation: isolate;
  line-height: 1.4;
}

#mp4mp3-app[data-theme="light"] {
  --mp4mp3-bg: #f3f4fb;
  --mp4mp3-panel: rgba(255,255,255,0.75);
  --mp4mp3-panel-border: rgba(20,20,40,0.08);
  --mp4mp3-text: #171923;
  --mp4mp3-text-dim: #565d75;
  --mp4mp3-shadow: 0 20px 40px rgba(90,90,140,0.15);
}

/* ---------- background decoration ---------- */
.mp4mp3-bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  z-index: 0;
  pointer-events: none;
}
.mp4mp3-bg-blob-1 {
  width: 480px; height: 480px;
  top: -160px; left: -120px;
  background: var(--mp4mp3-accent);
}
.mp4mp3-bg-blob-2 {
  width: 420px; height: 420px;
  bottom: -140px; right: -100px;
  background: var(--mp4mp3-accent-2);
}

/* ---------- header ---------- */
.mp4mp3-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 22px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--mp4mp3-panel-border);
}

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

.mp4mp3-logo {
  font-size: 34px;
  line-height: 1;
  filter: drop-shadow(0 4px 10px rgba(124,92,255,0.5));
}

.mp4mp3-brand h1 {
  margin: 0;
  font-size: clamp(18px, 2.4vw, 24px);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.mp4mp3-arrow {
  background: var(--mp4mp3-accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.mp4mp3-brand p {
  margin: 2px 0 0;
  font-size: 13.5px;
  color: var(--mp4mp3-text-dim);
}

.mp4mp3-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mp4mp3-badge {
  font-size: 12.5px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(41, 214, 138, 0.12);
  color: var(--mp4mp3-success);
  border: 1px solid rgba(41, 214, 138, 0.3);
  white-space: nowrap;
}

.mp4mp3-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--mp4mp3-panel-border);
  background: var(--mp4mp3-panel);
  color: var(--mp4mp3-text);
  font-size: 18px;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
.mp4mp3-icon-btn:hover { transform: translateY(-2px); background: rgba(255,255,255,0.08); }

/* ---------- main layout ---------- */
.mp4mp3-main {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(16px, 3vw, 36px) clamp(16px, 4vw, 48px) 8px;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: clamp(16px, 2vw, 28px);
  align-items: start;
}

@media (max-width: 900px) {
  .mp4mp3-main { grid-template-columns: 1fr; }
}

.mp4mp3-panel {
  background: var(--mp4mp3-panel);
  border: 1px solid var(--mp4mp3-panel-border);
  border-radius: var(--mp4mp3-radius);
  padding: clamp(18px, 2vw, 26px);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.mp4mp3-panel-title {
  margin: 0 0 18px;
  font-size: 16px;
  font-weight: 700;
}

/* ---------- settings panel ---------- */
.mp4mp3-field {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mp4mp3-field label {
  font-size: 13px;
  color: var(--mp4mp3-text-dim);
  font-weight: 600;
}

.mp4mp3-field select {
  padding: 10px 12px;
  border-radius: var(--mp4mp3-radius-sm);
  border: 1px solid var(--mp4mp3-panel-border);
  background: rgba(255,255,255,0.06);
  color: var(--mp4mp3-text);
  font-size: 14px;
  outline: none;
  cursor: pointer;
}
#mp4mp3-app[data-theme="light"] .mp4mp3-field select {
  background: #fff;
}

.mp4mp3-checkbox-field {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}
.mp4mp3-switch-label { font-weight: 600; font-size: 13.5px; color: var(--mp4mp3-text); cursor: pointer; }

.mp4mp3-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.mp4mp3-switch input { opacity: 0; width: 0; height: 0; }
.mp4mp3-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: rgba(255,255,255,0.15);
  border-radius: 999px;
  transition: .2s;
}
.mp4mp3-slider::before {
  content: "";
  position: absolute;
  height: 18px; width: 18px;
  left: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  transition: .2s;
}
.mp4mp3-switch input:checked + .mp4mp3-slider { background: var(--mp4mp3-accent); }
.mp4mp3-switch input:checked + .mp4mp3-slider::before { transform: translateX(18px); }

.mp4mp3-info-box {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--mp4mp3-text-dim);
  background: rgba(124,92,255,0.1);
  border: 1px solid rgba(124,92,255,0.25);
  padding: 12px 14px;
  border-radius: var(--mp4mp3-radius-sm);
  margin: 4px 0 18px;
}
.mp4mp3-info-box strong { color: var(--mp4mp3-text); }

.mp4mp3-features {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  font-size: 13px;
  color: var(--mp4mp3-text-dim);
}
.mp4mp3-features div {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: var(--mp4mp3-radius-sm);
  background: rgba(255,255,255,0.03);
}
.mp4mp3-features div span { font-size: 15px; }

/* ---------- dropzone panel ---------- */
.mp4mp3-dropzone-panel {
  display: flex;
  flex-direction: column;
  min-height: 60vh;
}

.mp4mp3-dropzone {
  border: 2px dashed var(--mp4mp3-panel-border);
  border-radius: var(--mp4mp3-radius);
  padding: clamp(28px, 5vw, 56px) 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, transform .15s ease;
  outline: none;
}
.mp4mp3-dropzone:hover, .mp4mp3-dropzone:focus-visible {
  border-color: var(--mp4mp3-accent);
  background: rgba(124,92,255,0.06);
}
.mp4mp3-dropzone.mp4mp3-dragover {
  border-color: var(--mp4mp3-accent-2);
  background: rgba(41,214,200,0.09);
  transform: scale(1.01);
}

.mp4mp3-dropzone-icon {
  font-size: 46px;
  margin-bottom: 10px;
}

.mp4mp3-dropzone h2 {
  margin: 6px 0;
  font-size: clamp(18px, 2.2vw, 22px);
}

.mp4mp3-or {
  margin: 8px 0;
  color: var(--mp4mp3-text-dim);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mp4mp3-hint {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--mp4mp3-text-dim);
}

.mp4mp3-btn-primary, .mp4mp3-btn-secondary, .mp4mp3-btn-ghost {
  border: none;
  cursor: pointer;
  font-weight: 700;
  border-radius: 999px;
  font-size: 14px;
  padding: 12px 26px;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.mp4mp3-btn-primary {
  background: var(--mp4mp3-accent-grad);
  color: #fff;
  box-shadow: 0 10px 24px rgba(124,92,255,0.35);
}
.mp4mp3-btn-primary:hover { transform: translateY(-2px); }

.mp4mp3-btn-secondary {
  background: rgba(124,92,255,0.15);
  color: var(--mp4mp3-text);
  border: 1px solid rgba(124,92,255,0.4);
  padding: 9px 18px;
}
.mp4mp3-btn-secondary:hover { background: rgba(124,92,255,0.25); }

.mp4mp3-btn-ghost {
  background: transparent;
  color: var(--mp4mp3-text-dim);
  border: 1px solid var(--mp4mp3-panel-border);
  padding: 9px 18px;
}
.mp4mp3-btn-ghost:hover { color: var(--mp4mp3-danger); border-color: var(--mp4mp3-danger); }

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

/* ---------- queue ---------- */
.mp4mp3-queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 26px;
  margin-bottom: 6px;
  flex-wrap: wrap;
  gap: 10px;
}
.mp4mp3-queue-header h3 { margin: 0; font-size: 15px; }
.mp4mp3-queue-actions { display: flex; gap: 10px; }

.mp4mp3-queue {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}

.mp4mp3-empty-state {
  text-align: center;
  color: var(--mp4mp3-text-dim);
  font-size: 13.5px;
  margin-top: 30px;
}

.mp4mp3-item {
  border: 1px solid var(--mp4mp3-panel-border);
  background: rgba(255,255,255,0.03);
  border-radius: var(--mp4mp3-radius-sm);
  padding: 16px;
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 14px;
  align-items: center;
  animation: mp4mp3-fadein .25s ease;
}
@keyframes mp4mp3-fadein {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.mp4mp3-item-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: var(--mp4mp3-accent-grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.mp4mp3-item-body { min-width: 0; }

.mp4mp3-item-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp4mp3-item-meta {
  font-size: 12px;
  color: var(--mp4mp3-text-dim);
  margin-top: 2px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.mp4mp3-waveform {
  width: 100%;
  height: 40px;
  margin-top: 8px;
  border-radius: 6px;
  display: block;
  background: rgba(255,255,255,0.03);
}

.mp4mp3-progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
  margin-top: 10px;
  display: none;
}
.mp4mp3-progress-track.mp4mp3-active { display: block; }
.mp4mp3-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--mp4mp3-accent-grad);
  transition: width .15s ease;
}

.mp4mp3-status-text {
  font-size: 12px;
  margin-top: 8px;
  font-weight: 600;
}
.mp4mp3-status-text.status-queued { color: var(--mp4mp3-text-dim); }
.mp4mp3-status-text.status-working { color: var(--mp4mp3-accent); }
.mp4mp3-status-text.status-done { color: var(--mp4mp3-success); }
.mp4mp3-status-text.status-error { color: var(--mp4mp3-danger); }

.mp4mp3-item-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  min-width: 130px;
}
.mp4mp3-item-actions button {
  width: 100%;
  white-space: nowrap;
}

.mp4mp3-audio-preview {
  margin-top: 10px;
  width: 100%;
  height: 34px;
}

@media (max-width: 640px) {
  .mp4mp3-item {
    grid-template-columns: 1fr;
  }
  .mp4mp3-item-icon { display: none; }
  .mp4mp3-item-actions { flex-direction: row; flex-wrap: wrap; }
  .mp4mp3-item-actions button { flex: 1 1 auto; }
}

/* ---------- footer ---------- */
.mp4mp3-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 18px 16px 26px;
  font-size: 12px;
  color: var(--mp4mp3-text-dim);
}

/* ---------- toasts ---------- */
.mp4mp3-toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 999;
}
.mp4mp3-toast {
  background: #1c1f2c;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.1);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  max-width: 320px;
  box-shadow: var(--mp4mp3-shadow);
  animation: mp4mp3-toast-in .2s ease;
}
.mp4mp3-toast.toast-error { border-color: var(--mp4mp3-danger); }
.mp4mp3-toast.toast-success { border-color: var(--mp4mp3-success); }
@keyframes mp4mp3-toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
