/* Twitter Video Downloader - frontend styles (scoped, no dependencies) */
.xtd-wrap {
  --xtd-grad: linear-gradient(135deg, #2fb3f7 0%, #0e7cc4 100%);
  --xtd-ink: #0f172a;
  --xtd-muted: #64748b;
  --xtd-line: #e6eaf0;
  --xtd-bg: #ffffff;
  --xtd-soft: #f2f9fe;
  max-width: 1140px;
  margin: 1.5rem auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--xtd-ink);
  box-sizing: border-box;
}
.xtd-wrap *, .xtd-wrap *::before, .xtd-wrap *::after { box-sizing: inherit; }

.xtd-card {
  position: relative;
  background: var(--xtd-bg);
  border: 1px solid var(--xtd-line);
  border-radius: 26px;
  padding: clamp(1rem, 2.5vw, 1.75rem) clamp(1.5rem, 4vw, 2.75rem);
  box-shadow: 0 14px 44px rgba(15, 23, 42, 0.07);
  overflow: hidden;
}
/* Gradient strip along the top edge */
.xtd-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: linear-gradient(90deg, #7fd4ff 0%, #1da1f2 50%, #0b5fa5 100%);
}

/* Brand header */
.xtd-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}
.xtd-brand { display: flex; align-items: center; gap: 0.65rem; }
.xtd-logo {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, #1da1f2 0%, #0b5fa5 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(29, 161, 242, 0.35);
  flex: none;
}
.xtd-brand-name { font-size: 1.12rem; font-weight: 800; letter-spacing: -0.01em; }
.xtd-chips { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.xtd-chip {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--xtd-muted);
  background: #f8fafc;
  border: 1px solid var(--xtd-line);
  border-radius: 999px;
  padding: 0.42rem 0.95rem;
  white-space: nowrap;
}

/* Heading */
.xtd-title {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--xtd-ink);
  line-height: 1.1;
}
.xtd-subtitle {
  margin: 0 0 1rem;
  color: var(--xtd-muted);
  font-size: 1.02rem;
  line-height: 1.55;
}

/* Mode tabs */
.xtd-tabs {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}
.xtd-tab {
  padding: 0.62rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--xtd-ink);
  background: #fff;
  border: 1px solid var(--xtd-line);
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.2s, background 0.2s, color 0.2s;
  font-family: inherit;
}
.xtd-tab:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08); }
.xtd-tab.is-active {
  color: #fff;
  border-color: transparent;
  background: var(--xtd-grad);
  box-shadow: 0 6px 16px rgba(29, 161, 242, 0.35);
}

/* Input + button row */
.xtd-form { display: flex; gap: 0.9rem; align-items: stretch; }
.xtd-input-wrap {
  flex: 1 1 auto;
  min-width: 0;
  border-radius: 18px;
  padding: 2px;
  background: linear-gradient(90deg, #7fd4ff 0%, #1da1f2 55%, #0b5fa5 100%);
  box-shadow: 0 6px 18px rgba(29, 161, 242, 0.12);
}
.xtd-input-inner {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #fff;
  border-radius: 16px;
  padding: 0.35rem 0.45rem 0.35rem 1rem;
  height: 100%;
  transition: box-shadow 0.2s;
}
.xtd-input-wrap:focus-within .xtd-input-inner {
  box-shadow: inset 0 0 0 2px rgba(29, 161, 242, 0.25);
}
.xtd-input-icon { color: #94a3b8; display: inline-flex; flex: none; }
.xtd-input {
  flex: 1 1 auto;
  min-width: 0;
  border: none !important;
  outline: none;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 1rem;
  padding: 0.8rem 0.25rem;
  margin: 0;
  color: var(--xtd-ink);
  font-family: inherit;
  height: auto;
}
.xtd-input::placeholder { color: #9aa5b5; }
.xtd-input:focus { outline: none; }
.xtd-input[aria-invalid="true"] { box-shadow: inset 0 0 0 2px #ff6b6b !important; border-radius: 12px; }
.xtd-paste {
  flex: none;
  border: none;
  background: #edf0f6;
  color: #334155;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 12px;
  padding: 0.72rem 1.5rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.xtd-paste:hover { background: #e2e8f0; }

.xtd-submit {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 2.1rem;
  font-size: 1.06rem;
  font-weight: 800;
  color: #fff;
  background: var(--xtd-grad);
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.2s, box-shadow 0.2s;
  box-shadow: 0 10px 26px rgba(29, 161, 242, 0.38);
  white-space: nowrap;
  font-family: inherit;
}
.xtd-submit:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(29, 161, 242, 0.42); }
.xtd-submit:active { transform: translateY(0); }
.xtd-submit:disabled { opacity: 0.75; cursor: wait; transform: none; }
.xtd-btn-arrow { font-size: 1.1em; line-height: 1; }

.xtd-spinner {
  display: none;
  width: 1em; height: 1em;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: xtd-spin 0.7s linear infinite;
}
.xtd-submit.xtd-loading .xtd-spinner { display: inline-block; }
.xtd-submit.xtd-loading .xtd-btn-arrow { display: none; }
@keyframes xtd-spin { to { transform: rotate(360deg); } }

.xtd-example { margin: 0.7rem 0.25rem 0; color: var(--xtd-muted); font-size: 0.82rem; }

/* Status + results */
.xtd-message { margin: 1rem 0 0; padding: 0.85rem 1.1rem; border-radius: 12px; background: #e9f5ff; color: #16577c; font-size: 0.95rem; }
.xtd-message[hidden] { display: none !important; }
.xtd-message.xtd-error { background: #fff0ef; color: #9d3228; }

.xtd-results { margin-top: 0.5rem; }
.xtd-results[hidden] { display: none !important; }
.xtd-results-head { margin: 1rem 0 1rem; }
.xtd-results-head h3 { margin: 0 0 0.3rem; font-size: 1.3rem; font-weight: 800; letter-spacing: -0.01em; }
.xtd-results-head p { margin: 0; color: var(--xtd-muted); font-size: 0.9rem; }
.xtd-media-list { display: grid; gap: 1rem; }
.xtd-media-card {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--xtd-line);
  border-radius: 18px;
  background: var(--xtd-soft);
}
.xtd-poster { width: 250px; max-height: 250px; object-fit: cover; background: #dbeefb; flex: none; }
.xtd-media-body { flex: 1; min-width: 0; padding: 1.25rem; }
.xtd-media-body h4 { margin: 0 0 0.9rem; font-size: 1.05rem; font-weight: 800; }
.xtd-options { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.xtd-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 41px;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  background: var(--xtd-grad);
  color: #fff !important;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none !important;
  transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(29, 161, 242, 0.28);
}
.xtd-download:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(29, 161, 242, 0.34); color: #fff !important; }

/* Steps */
.xtd-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.4rem;
  margin-top: 1.5rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--xtd-line);
}
.xtd-steps > div { display: grid; grid-template-columns: 36px 1fr; column-gap: 0.65rem; align-items: start; }
.xtd-steps span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #e8f5ff;
  color: #1a8cd8;
  font-weight: 800;
}
.xtd-steps strong { margin: 0 0 0.2rem; font-size: 0.9rem; }
.xtd-steps p { margin: 0; color: var(--xtd-muted); font-size: 0.8rem; line-height: 1.5; }

.xtd-note {
  margin: 1.2rem 0 0;
  font-size: 0.88rem;
  color: var(--xtd-muted);
  text-align: center;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .xtd-form { flex-direction: column; }
  .xtd-submit { width: 100%; }
  .xtd-chips { display: none; }
  .xtd-media-card { flex-direction: column; }
  .xtd-poster { width: 100%; max-height: 290px; }
  .xtd-media-body { padding: 1.1rem; }
  .xtd-download { width: 100%; }
  .xtd-steps { grid-template-columns: 1fr; gap: 1rem; }
}
