/* Anime Mirror — stylesheet
 * Plain CSS, no preprocessors, no framework.
 * Dark theme by default with a small "violet + slate" accent palette
 * (avoiding indigo/blue per project conventions).
 */

:root {
  --bg: #0b0d12;
  --bg-elev: #131722;
  --bg-elev-2: #1c2230;
  --border: #232a3a;
  --text: #e6e9ef;
  --text-muted: #8a92a6;
  --text-dim: #5d6577;
  --accent: #a78bfa; /* violet */
  --accent-2: #f472b6; /* pink, for second accent */
  --accent-soft: rgba(167, 139, 250, 0.15);
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

code {
  background: var(--bg-elev-2);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: "JetBrains Mono", "SF Mono", Menlo, monospace;
  font-size: 0.88em;
  color: var(--accent);
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 13, 18, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 60px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-text { font-size: 16px; }

.logo-tag {
  margin-left: 6px;
  padding: 2px 8px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}

.top-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.nav-link {
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: var(--bg-elev); color: var(--text); text-decoration: none; }
.nav-link.active { color: var(--text); background: var(--bg-elev); }
.nav-link.muted { color: var(--text-dim); }

.search-form {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex: 1;
  max-width: 480px;
}
.search-form input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.search-form input:focus { border-color: var(--accent); }
.search-form button {
  padding: 8px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s;
}
.search-form button:hover { filter: brightness(1.1); }

/* ---------- hero ---------- */
.hero {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.hero h1 {
  font-size: 36px;
  font-weight: 700;
  margin: 0 0 12px;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.badge {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  letter-spacing: 0;
}
.hero .lead {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 760px;
  margin: 0 0 20px;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.meta-pill {
  padding: 4px 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-muted);
}
.meta-pill code { background: transparent; padding: 0; color: var(--accent); }

/* ---------- grid ---------- */
.grid-section { padding-bottom: 64px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-head h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

.ghost-btn {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ghost-btn:hover {
  background: var(--bg-elev);
  border-color: var(--accent);
  text-decoration: none;
}
.ghost-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.anime-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
}

.anime-card {
  display: block;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
  cursor: pointer;
}
.anime-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.anime-card .poster {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--bg-elev-2);
  overflow: hidden;
}
.anime-card .poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.anime-card .ep-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 8px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}
.anime-card .info {
  padding: 10px 12px 12px;
}
.anime-card .info h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 38px;
}
.anime-card .info .sub {
  font-size: 12px;
  color: var(--text-dim);
}

.skeleton-card {
  aspect-ratio: 2 / 3.4;
  background: linear-gradient(
    90deg,
    var(--bg-elev) 0%,
    var(--bg-elev-2) 50%,
    var(--bg-elev) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- footer ---------- */
.site-footer {
  margin-top: auto;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
}
.site-footer p {
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
}

/* ---------- watch page ---------- */
.watch-container {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  padding-top: 24px;
  padding-bottom: 64px;
}

@media (max-width: 900px) {
  .watch-container { grid-template-columns: 1fr; }
  .search-form { max-width: none; }
}

.watch-header { margin-bottom: 14px; }
.watch-header h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
  line-height: 1.3;
}
.muted { color: var(--text-muted); font-size: 13px; }

.player-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.player-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #000;
  color: var(--text-muted);
  font-size: 13px;
}
.player-loading.hidden { display: none; }

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#player-slot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#player-slot iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.player-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
  background: #1a0d0d;
  color: var(--err);
}
.player-error h4 { margin: 0; font-size: 16px; }
.player-error p { margin: 0; color: var(--text-muted); font-size: 13px; }

.server-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
  padding: 10px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}
.server-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.server-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.server-btn {
  padding: 5px 12px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.server-btn:hover { border-color: var(--accent); }
.server-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.server-btn.loading { opacity: 0.5; cursor: wait; }
.server-btn[disabled] { opacity: 0.4; cursor: not-allowed; }

.player-actions {
  display: flex;
  gap: 8px;
  margin: 12px 0 24px;
  flex-wrap: wrap;
}

.episode-list-wrap h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 12px;
}
.episode-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 6px;
  max-height: 360px;
  overflow-y: auto;
  padding: 4px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.episode-list a {
  padding: 6px 8px;
  text-align: center;
  background: var(--bg-elev-2);
  border: 1px solid transparent;
  color: var(--text-muted);
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
}
.episode-list a:hover {
  background: var(--bg-elev);
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}
.episode-list a.active {
  background: var(--accent);
  color: white;
}

/* sidebar */
.watch-sidebar {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  position: sticky;
  top: 80px;
  height: fit-content;
}
.watch-sidebar img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  background: var(--bg-elev-2);
}
.skeleton-poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  background: linear-gradient(
    90deg, var(--bg-elev-2) 0%, var(--bg-elev) 50%, var(--bg-elev-2) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}
.watch-sidebar h2 {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 10px;
  line-height: 1.3;
}
.anime-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.anime-meta .meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.anime-meta .meta-row .lbl { color: var(--text-dim); }
.anime-meta .meta-row .val { color: var(--text); }
.anime-meta .genres {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.anime-meta .genres span {
  padding: 2px 8px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}
.anime-desc {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0;
  max-height: 240px;
  overflow-y: auto;
}

/* toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  box-shadow: var(--shadow);
  z-index: 100;
  animation: toastIn 0.2s;
}
.toast.err { border-color: var(--err); color: var(--err); }
.toast.ok { border-color: var(--ok); color: var(--ok); }
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* html / body sticky footer */
html, body { height: auto; min-height: 100vh; }
body { display: flex; flex-direction: column; }
main { flex: 1 0 auto; }

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg-elev-2); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--border); }
