/* ─────────────────────────────────────────
   EpiCountdown – styles.css
   Dark-mode-first, modern sleek aesthetic
───────────────────────────────────────── */

/* ── Reset & Variables ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-base: #0d0d14;
  --bg-card: #13131f;
  --bg-card-hover: #1a1a2e;
  --bg-nav: rgba(13, 13, 20, 0.85);
  --accent-1: #7c3aed; /* violet */
  --accent-2: #06b6d4; /* cyan   */
  --accent-glow: rgba(124, 58, 237, 0.35);
  --text-primary: #f0f0f8;
  --text-secondary: #a0a0c0;
  --text-muted: #6060a0;
  --border: rgba(255, 255, 255, 0.07);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.55);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Inter', system-ui, sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

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

img {
  display: block;
  max-width: 100%;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
  background: var(--accent-1);
  border-radius: 4px;
}

/* ── NAV ── */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
}

.nav__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.logo-icon {
  font-size: 1.3rem;
}

.logo-text {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav__links {
  display: flex;
  gap: 2rem;
}

.nav__link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition);
}

.nav__link:hover {
  color: var(--text-primary);
}

/* ── HERO ── */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 100px 1.5rem 60px;
  overflow: hidden;
  text-align: center;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(124, 58, 237, 0.25) 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(6, 182, 212, 0.12) 0%, transparent 60%);
  pointer-events: none;
}

/* animated particle grid overlay */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}

.hero__bg-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 30%, var(--bg-base) 80%);
  pointer-events: none;
  z-index: 1;
}

.hero__content {
  position: relative;
  z-index: 2;
  max-width: 780px;
  width: 100%;
}

.hero__title {
  font-size: clamp(2rem, 5vw, 3.75rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #fff 0%, var(--accent-2) 50%, var(--accent-1) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero__subtitle {
  color: var(--text-secondary);
  font-size: clamp(1rem, 2vw, 1.2rem);
  margin-bottom: 2.5rem;
  font-weight: 300;
}

/* ── SEARCH ── */
.search-form {
  width: 100%;
}

.search-wrapper {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  padding: 0.4rem 0.4rem 0.4rem 1.2rem;
  gap: 0.75rem;
  backdrop-filter: blur(8px);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.search-wrapper:focus-within {
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-icon {
  font-size: 1rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 1rem;
  caret-color: var(--accent-1);
}

.search-input::placeholder {
  color: var(--text-muted);
}

/* clear button from browser */
.search-input::-webkit-search-cancel-button {
  filter: invert(1) opacity(0.4);
}

.search-btn {
  background: linear-gradient(135deg, var(--accent-1), #9b59d4);
  color: #fff;
  border: none;
  border-radius: 9999px;
  padding: 0.55rem 1.4rem;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    opacity var(--transition),
    transform var(--transition);
  flex-shrink: 0;
}

.search-btn:hover {
  opacity: 0.85;
  transform: scale(1.02);
}
.search-btn:active {
  transform: scale(0.98);
}

/* ── Search Results ── */
.search-results {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: min(760px, calc(100vw - 3rem));
  margin-top: 0.75rem;
  background: #1a1a2e;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  z-index: 50;
  overflow: hidden;
  max-height: 70vh;
  overflow-y: auto;
}

.search-results__header {
  padding: 0.8rem 1.2rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.2rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition:
    background var(--transition),
    transform var(--transition);
}

.search-result-item:last-child {
  border-bottom: none;
}
.search-result-item:hover {
  background: rgba(124, 58, 237, 0.18);
  transform: translateX(4px);
}

.search-result-item:active {
  background: rgba(124, 58, 237, 0.25);
  transform: translateX(2px);
}

.search-result-item img {
  width: 44px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  background: var(--bg-base);
}

.search-result-item__info {
  flex: 1;
  min-width: 0;
}

.search-result-item__title {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-item__meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.search-no-results {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── MAIN CONTENT ── */
.main-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

.content-section {
  margin-bottom: 4rem;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-accent {
  font-size: 1.3rem;
}

.section-badge {
  background: rgba(124, 58, 237, 0.2);
  color: var(--accent-1);
  border: 1px solid rgba(124, 58, 237, 0.35);
  border-radius: 9999px;
  padding: 0.15rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
}

/* ── CARDS GRID ── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}

/* ── CARD ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    border-color var(--transition);
  box-shadow: var(--shadow-card);
  cursor: pointer;
}

.card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow:
    0 20px 60px rgba(124, 58, 237, 0.4),
    0 0 0 2px var(--accent-1);
  border-color: var(--accent-1);
  background: var(--bg-card-hover);
}

.card:active {
  transform: translateY(-4px) scale(1.01);
}

.card__image-wrap {
  position: relative;
  aspect-ratio: 3/4;
  overflow: hidden;
  background: #0a0a12;
}

.card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.card:hover .card__image {
  transform: scale(1.06);
}

.card__status-badge {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  border-radius: 9999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid var(--border);
}

.badge--airing {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.3);
}
.badge--completed {
  color: var(--text-muted);
}
.badge--tba {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.3);
}

/* Placeholder image */
.card__image[src=''] {
  visibility: hidden;
}

.card__image-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  color: var(--text-muted);
  background: linear-gradient(135deg, #1a1a2e, #0d0d20);
}

.card__body {
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
}

.card__title {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__episode {
  font-size: 0.78rem;
  color: var(--accent-2);
  font-weight: 600;
}

/* ── COUNTDOWN ── */
.card__countdown {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.4rem;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border);
}

.countdown-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 2.4rem;
}

.countdown-value {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.countdown-label {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-top: 2px;
}

.countdown-sep {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-muted);
  padding-bottom: 0.8rem;
  line-height: 1;
}

/* TBA / Completed state */
.card__countdown--tba,
.card__countdown--completed {
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.65rem;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

.card__countdown--tba {
  color: #f59e0b;
}
.card__countdown--completed {
  color: var(--text-muted);
}

/* ── CARD META ── */
.card__meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.4rem;
  margin-top: auto;
}

.card__rating {
  font-size: 0.78rem;
  font-weight: 700;
  color: #f59e0b;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}

.card__genres {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: right;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── LOADING STATE ── */
.loading-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 4rem 0;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-1);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── ERROR STATE ── */
.error-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 0;
  color: var(--text-muted);
}

.error-state p {
  margin-bottom: 0.5rem;
}
.error-state .error-detail {
  font-size: 0.85rem;
  color: #f87171;
}

/* ── FOOTER ── */
.footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer a {
  color: var(--accent-2);
  transition: opacity var(--transition);
}

.footer a:hover {
  opacity: 0.75;
}

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .nav__links {
    display: none;
  }

  .hero {
    padding-top: 80px;
  }

  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.85rem;
  }

  .countdown-value {
    font-size: 1rem;
  }
  .countdown-unit {
    min-width: 1.9rem;
  }
}

@media (max-width: 420px) {
  .cards-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Highlight animation on card when countdown ticks ── */
@keyframes tick-pulse {
  0% {
    color: var(--accent-2);
  }
  100% {
    color: var(--text-primary);
  }
}

.tick-flash {
  animation: tick-pulse 0.4s ease;
}
