/* ── GD Player Global Styles ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --surface2: #1c1c28;
  --border: #2a2a3c;
  --accent: #7c3aed;
  --accent2: #a855f7;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 12px;
  --font: 'Inter', system-ui, sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

.logo-icon {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  font-size: .9rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1.25rem;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  width: 100%;
  justify-content: center;
  padding: .85rem;
  font-size: 1rem;
}

.btn-primary:hover {
  opacity: .9;
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent2);
}

/* ── Hero ── */
.hero {
  text-align: center;
  padding: 4rem 1.5rem 2rem;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 700;
  color: #fff;
  margin-bottom: .75rem;
  line-height: 1.2;
}

.hero p {
  color: var(--muted);
  font-size: 1.1rem;
}

/* ── Video Grid ── */
.video-grid-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.video-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.video-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 32px rgba(124, 58, 237, .2);
}

.card-thumb {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--surface2);
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s ease;
}

.video-card:hover .card-thumb img {
  transform: scale(1.05);
}

.play-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .4);
  font-size: 2rem;
  opacity: 0;
  transition: opacity .2s ease;
}

.video-card:hover .play-overlay {
  opacity: 1;
}

.card-info {
  padding: .75rem 1rem 1rem;
}

.card-title {
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: .4rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-slug {
  font-size: .75rem;
  color: var(--accent2);
  font-family: monospace;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 5rem 1rem;
  color: var(--muted);
}

.empty-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
}

.empty-state a {
  color: var(--accent2);
  text-decoration: underline;
}

/* ── Player Page ── */
.player-page {
  min-height: 100vh;
  background: var(--bg);
}

.player-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.video-title {
  font-size: clamp(1.1rem, 2.5vw, 1.6rem);
  font-weight: 700;
  margin-bottom: 1.25rem;
  line-height: 1.4;
}

.video-wrapper {
  position: relative;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  box-shadow: 0 16px 64px rgba(0, 0, 0, .6);
}

.video-element {
  width: 100%;
  display: block;
  max-height: 540px;
  background: #000;
}

.video-meta {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .25rem .65rem;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--accent2);
}

.copy-url {
  margin-left: auto;
  cursor: pointer;
  font-size: .85rem;
  color: var(--muted);
  transition: color .2s;
  user-select: none;
}

.copy-url:hover {
  color: var(--accent2);
}

/* ── Admin Page ── */
.admin-page {
  min-height: 100vh;
}

.admin-container {
  max-width: 600px;
  margin: 3rem auto;
  padding: 0 1.5rem;
}

.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
}

.admin-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: .5rem;
}

.admin-sub {
  color: var(--muted);
  margin-bottom: 2rem;
  font-size: .95rem;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.form-group label {
  font-size: .9rem;
  font-weight: 500;
  color: var(--muted);
}

.form-group input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .75rem 1rem;
  color: var(--text);
  font-family: var(--font);
  font-size: .95rem;
  transition: border-color .2s;
  outline: none;
}

.form-group input:focus {
  border-color: var(--accent);
}

.form-group input::placeholder {
  color: #475569;
}

/* ── Alerts ── */
.alert {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border-radius: 8px;
  font-size: .9rem;
  line-height: 1.6;
}

.alert-error {
  background: rgba(239, 68, 68, .1);
  border: 1px solid rgba(239, 68, 68, .3);
  color: #fca5a5;
}

.alert-success {
  background: rgba(34, 197, 94, .1);
  border: 1px solid rgba(34, 197, 94, .3);
  color: #86efac;
}

.alert-success p {
  font-weight: 600;
  margin-bottom: .75rem;
}

.result-url {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .5rem;
  flex-wrap: wrap;
}

.result-url span {
  color: var(--muted);
  font-size: .8rem;
  min-width: 60px;
}

.result-url a {
  color: var(--accent2);
  word-break: break-all;
}

.result-url a:hover {
  text-decoration: underline;
}

.result-url code {
  background: var(--bg);
  padding: .1rem .4rem;
  border-radius: 4px;
  font-size: .8rem;
  word-break: break-all;
}

/* ── Folder Import ── */
.api-key-note {
  background: rgba(245, 158, 11, .08);
  border: 1px solid rgba(245, 158, 11, .25);
  color: #fcd34d;
  border-radius: 8px;
  padding: .75rem 1rem;
  font-size: .82rem;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.api-key-note code {
  background: rgba(0, 0, 0, .3);
  padding: .1rem .35rem;
  border-radius: 4px;
  font-size: .8rem;
}

.import-stats {
  display: flex;
  gap: 1.5rem;
  margin: .5rem 0 .75rem;
}

.stat {
  font-size: .9rem;
  color: #86efac;
}

.import-list {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  max-height: 260px;
  overflow-y: auto;
  padding-right: .25rem;
}

.import-item {
  display: flex;
  gap: .75rem;
  justify-content: space-between;
  align-items: center;
  font-size: .8rem;
  background: rgba(0, 0, 0, .2);
  padding: .35rem .6rem;
  border-radius: 6px;
  flex-wrap: wrap;
}

.import-item span {
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-item a {
  color: var(--accent2);
  white-space: nowrap;
  flex-shrink: 0;
}

.import-item a:hover {
  text-decoration: underline;
}

/* ── Live Import Progress ── */
.import-live {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.progress-wrap {
  position: relative;
  height: 10px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: visible;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 99px;
  transition: width .3s ease;
}

.progress-label {
  display: block;
  text-align: right;
  font-size: .75rem;
  color: var(--muted);
  margin-top: .35rem;
}

.import-log {
  background: #060609;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .75rem;
  max-height: 300px;
  overflow-y: auto;
  font-family: monospace;
  font-size: .78rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.log-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  padding: .25rem .4rem;
  border-radius: 4px;
  flex-wrap: wrap;
  animation: fadeIn .2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.log-imported {
  background: rgba(34, 197, 94, .07);
}

.log-skip {
  background: rgba(148, 163, 184, .05);
}

.log-error {
  background: rgba(239, 68, 68, .08);
}

.log-done {
  background: rgba(124, 58, 237, .1);
}

.log-status {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--muted);
}

.log-msg {
  color: var(--text);
  flex: 1;
  word-break: break-all;
}

.log-imported .log-msg {
  color: #86efac;
}

.log-skip .log-msg {
  color: var(--muted);
}

.log-error .log-msg {
  color: #fca5a5;
}

.log-done .log-msg {
  color: var(--accent2);
  font-weight: 600;
}

.log-start .log-msg {
  color: #fcd34d;
}

.log-url {
  font-size: .7rem;
  color: var(--accent2);
  white-space: nowrap;
  flex-shrink: 0;
}

.log-url:hover {
  text-decoration: underline;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--accent2);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Hero badge ── */
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  background: rgba(124, 58, 237, .12);
  border: 1px solid rgba(124, 58, 237, .35);
  color: var(--accent2);
  border-radius: 99px;
  padding: .3rem .9rem;
  font-size: .8rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
  letter-spacing: .03em;
}

.hero-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent2);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: .5;
    transform: scale(.7);
  }
}

/* ── Hero gradient text ── */
.hero-gradient {
  background: linear-gradient(90deg, var(--accent2), #e879f9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Override hero h1 so gradient word still works ── */
.hero h1 {
  -webkit-text-fill-color: unset;
  background: none;
  color: #fff;
}

/* ── Hero sub text ── */
.hero-sub {
  color: var(--muted);
  font-size: 1.05rem;
  margin-top: .75rem;
  letter-spacing: .01em;
}

/* ── Hero action buttons ── */
.hero-actions {
  display: flex;
  gap: .75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.75rem;
}

.btn-hero-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  padding: .7rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: .95rem;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: opacity .2s, transform .2s;
  box-shadow: 0 4px 20px rgba(124, 58, 237, .4);
}

.btn-hero-primary:hover {
  opacity: .9;
  transform: translateY(-2px);
}

.btn-hero-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: .7rem 1.5rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: .95rem;
  display: inline-flex;
  align-items: center;
  transition: border-color .2s, color .2s;
}

.btn-hero-outline:hover {
  border-color: var(--accent);
  color: var(--accent2);
}

/* ── Hero stats ── */
.hero-stats {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin-top: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .9rem 1.75rem;
  gap: .2rem;
}

.hero-stat strong {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.hero-stat span {
  font-size: .72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 500;
}

.hero-stat-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
}

/* ── Features Section ── */
.features-section {
  padding: 4rem 1.5rem;
}

.features-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.section-label {
  text-align: center;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--accent2);
  font-weight: 600;
  margin-bottom: 2.5rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}

.feature-card:hover {
  border-color: rgba(124, 58, 237, .5);
  transform: translateY(-4px);
  box-shadow: 0 8px 28px rgba(124, 58, 237, .15);
}

.feature-icon {
  display: block;
  font-size: 1.75rem;
  margin-bottom: 1rem;
  line-height: 1;
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: .5rem;
  color: var(--text);
}

.feature-card p {
  font-size: .875rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ── Site Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-copy {
  font-size: .85rem;
  color: var(--muted);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .85rem;
}

.footer-links a {
  color: var(--muted);
  transition: color .15s;
}

.footer-links a:hover {
  color: var(--accent2);
}

.footer-dot {
  color: var(--border);
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .admin-card {
    padding: 1.5rem;
  }

  .header-inner {
    padding: .75rem 1rem;
  }

  .import-stats {
    flex-direction: column;
    gap: .5rem;
  }

  .hero-stats {
    flex-direction: column;
    width: 100%;
  }

  .hero-stat-divider {
    width: 80%;
    height: 1px;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}