* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --black: #0a0a0f;
  --dark-gray: #121220;
  --medium-gray: #1a1a2e;
  --card-bg: #16162a;
  --dark-purple: #2d1b69;
  --purple: #7c3aed;
  --purple-hover: #6d28d9;
  --purple-light: #a78bfa;
  --text-primary: #ffffff;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --border: #1f1f3a;
  --gradient-hero: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #2d1b69 100%);
  --gradient-card: linear-gradient(180deg, transparent 0%, #0a0a0f 100%);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.3s ease;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--black);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--purple-light);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--purple);
}

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

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--black);
}

::-webkit-scrollbar-thumb {
  background: var(--dark-purple);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--purple);
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Nav Right */
.nav-right {
  display: flex;
  align-items: center;
}

.nav-right-items {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-right-items a {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
}

.nav-right-items a:hover {
  color: var(--text-primary);
}

.nav-username {
  color: var(--text-muted);
  font-size: 0.8rem;
}

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

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo:hover {
  color: var(--purple-light);
}

.logo span {
  color: var(--purple);
}

.logo i {
  font-size: 1.3rem;
  color: var(--purple);
}

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

.nav a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
}

.nav a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--purple);
  transition: var(--transition);
}

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

.nav a:hover::after {
  width: 100%;
}

.nav a.active {
  color: var(--text-primary);
}

.nav a.active::after {
  width: 100%;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--medium-gray);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  gap: 8px;
  transition: var(--transition);
  width: 280px;
}

.search-box:focus-within {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.search-box i {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.search-box input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  width: 100%;
}

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

/* Search Results Dropdown */
.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--dark-gray);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 4px;
  max-height: 400px;
  overflow-y: auto;
  display: none;
  z-index: 200;
  box-shadow: var(--shadow);
}

.search-results.active {
  display: block;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: var(--transition);
}

.search-result-item:hover {
  background: var(--medium-gray);
}

.search-result-item img {
  width: 40px;
  height: 56px;
  object-fit: cover;
  border-radius: 4px;
}

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

.search-result-item .info h4 {
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-item .info span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Hero Section */
.hero {
  background: var(--gradient-hero);
  padding: 80px 0 60px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%237c3aed' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--purple-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 32px;
}

/* Section */
.section {
  padding: 48px 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title i {
  color: var(--purple);
  font-size: 1.2rem;
}

/* Anime Grid */
.anime-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}

.anime-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid var(--border);
  position: relative;
}

.anime-card:hover {
  transform: translateY(-4px);
  border-color: var(--dark-purple);
  box-shadow: 0 8px 30px rgba(124, 58, 237, 0.15);
}

.anime-card .poster {
  aspect-ratio: 2/3;
  overflow: hidden;
  position: relative;
}

.anime-card .poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.anime-card:hover .poster img {
  transform: scale(1.05);
}

.anime-card .poster .overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-card);
  opacity: 0;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.anime-card:hover .poster .overlay {
  opacity: 1;
}

.anime-card .poster .overlay-buttons {
  display: flex;
  gap: 12px;
}

.overlay-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.6);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.overlay-btn:hover {
  background: var(--purple);
  border-color: var(--purple);
  transform: scale(1.1);
}

.overlay-btn.watchlist-btn.saved {
  background: var(--purple);
  border-color: var(--purple);
}

.ep-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--purple);
  color: white;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Watchlist button in detail/watch pages */
.watchlist-btn.saved {
  background: rgba(124, 58, 237, 0.15);
  border-color: var(--purple);
  color: var(--purple-light);
}

.watchlist-btn.saved i {
  color: var(--purple-light);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 1.3rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  margin-bottom: 20px;
}

/* Remove button on watchlist cards */
.remove-wl-btn {
  color: #ef4444 !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  background: rgba(239, 68, 68, 0.1) !important;
}

.remove-wl-btn:hover {
  background: rgba(239, 68, 68, 0.25) !important;
}

.anime-card:hover .poster .overlay i {
  font-size: 2.5rem;
  color: white;
  opacity: 0.8;
}

.anime-card .score {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.8);
  color: var(--purple-light);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

.anime-card .score i {
  font-size: 0.65rem;
}

.anime-card .card-body {
  padding: 12px;
}

.anime-card .card-body h3 {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.anime-card .card-body .meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Featured Banner */
.featured-banner {
  margin: -60px 0 48px;
  position: relative;
  z-index: 1;
}

.featured-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  height: 400px;
  display: flex;
  align-items: flex-end;
  border: 1px solid var(--border);
}

.featured-card .bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-size: cover;
  background-position: center;
}

.featured-card .bg-gradient {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(0deg, #0a0a0f 0%, rgba(10, 10, 15, 0.4) 60%, transparent 100%);
}

.featured-card .featured-info {
  position: relative;
  z-index: 1;
  padding: 40px;
  max-width: 600px;
}

.featured-card .featured-info .badge {
  display: inline-block;
  background: var(--purple);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.featured-card .featured-info h2 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.featured-card .featured-info p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.featured-card .featured-info .meta-row {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.featured-card .featured-info .meta-row .dot {
  width: 4px;
  height: 4px;
  background: var(--text-muted);
  border-radius: 50%;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background: var(--purple);
  color: white;
}

.btn-primary:hover {
  background: var(--purple-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

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

.btn-outline:hover {
  border-color: var(--purple);
  color: var(--purple-light);
}

/* Form Elements */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group label .hint {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.8rem;
}

.form-group label .required {
  color: var(--purple-light);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  background: var(--medium-gray);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.form-error {
  color: #ef4444;
  font-size: 0.85rem;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.form-success {
  color: #22c55e;
  font-size: 0.85rem;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: rgba(34, 197, 94, 0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--dark-gray);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 0;
}

.modal-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 4px;
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--medium-gray);
}

.modal-body {
  padding: 20px 24px 24px;
}

/* Admin Panel */
.admin-card {
  background: var(--dark-gray);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.admin-card-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-card-header h3 i {
  color: var(--purple);
  font-size: 1rem;
}

.admin-card-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.admin-badge {
  background: var(--purple);
  color: white;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tr:hover td {
  background: rgba(124, 58, 237, 0.05);
}

.admin-username {
  font-weight: 600;
}

.admin-role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.admin-role-badge.admin {
  background: rgba(124, 58, 237, 0.15);
  color: var(--purple-light);
}

.admin-role-badge.user {
  background: rgba(156, 163, 175, 0.1);
  color: var(--text-secondary);
}

.admin-status {
  font-size: 0.85rem;
}

.admin-status.active {
  color: #22c55e;
}

.admin-status.banned {
  color: #ef4444;
}

.admin-actions {
  display: flex;
  gap: 8px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-warning {
  background: rgba(234, 179, 8, 0.15);
  color: #eab308;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.btn-warning:hover {
  background: rgba(234, 179, 8, 0.25);
}

.admin-form .form-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
}

.admin-form .form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

/* Toggle Switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  cursor: pointer;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--medium-gray);
  border: 1px solid var(--border);
  border-radius: 26px;
  transition: var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 2px;
  bottom: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: var(--transition);
}

.toggle input:checked + .toggle-slider {
  background: rgba(124, 58, 237, 0.2);
  border-color: var(--purple);
}

.toggle input:checked + .toggle-slider::before {
  background: var(--purple);
  transform: translateX(22px);
}

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  flex-direction: column;
  gap: 16px;
}

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

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

.loading p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.error-msg {
  text-align: center;
  padding: 60px;
  color: var(--text-muted);
}

.error-msg i {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.error-msg h3 {
  margin-bottom: 8px;
  color: var(--text-secondary);
}

/* Anime Detail Page */
.anime-detail-header {
  position: relative;
  min-height: 450px;
  display: flex;
  align-items: flex-end;
  padding-top: 80px;
}

.anime-detail-header .bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-size: cover;
  background-position: center top;
}

.anime-detail-header .bg-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(10, 10, 15, 0.3) 0%, #0a0a0f 100%);
}

.anime-detail-header .detail-content {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 32px;
  padding-bottom: 40px;
  align-items: flex-end;
}

.anime-detail-header .cover {
  width: 220px;
  flex-shrink: 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border);
}

.anime-detail-header .cover img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
}

.anime-detail-header .detail-info {
  flex: 1;
  min-width: 0;
}

.anime-detail-header .detail-info h1 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.anime-detail-header .detail-info .alt-title {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 16px;
}

.anime-detail-header .detail-info .meta-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.anime-detail-header .detail-info .meta-list .tag {
  background: var(--medium-gray);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.anime-detail-header .detail-info .genres {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.anime-detail-header .detail-info .genres span {
  background: rgba(124, 58, 237, 0.1);
  color: var(--purple-light);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  border: 1px solid rgba(124, 58, 237, 0.2);
}

.anime-detail-header .detail-info .description {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
  max-width: 700px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.anime-detail-body {
  padding: 32px 0 64px;
}

.episode-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.episode-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.episode-item:hover {
  border-color: var(--purple);
  background: rgba(124, 58, 237, 0.1);
  transform: translateY(-2px);
}

.episode-item .ep-num {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--purple-light);
}

.episode-item .ep-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Dub Fallback */
.dub-fallback {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(124, 58, 237, 0.08);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: var(--radius-sm);
  margin: 12px auto;
  max-width: 1100px;
}

.dub-fallback i {
  font-size: 1.3rem;
  color: var(--purple-light);
  flex-shrink: 0;
}

.dub-fallback div {
  flex: 1;
}

.dub-fallback p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.dub-fallback span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.dub-fallback .btn {
  flex-shrink: 0;
  white-space: nowrap;
  font-size: 0.8rem;
  padding: 6px 14px;
}

/* Watch Page */
.watch-page {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 64px);
  background: #000;
}

.player-wrapper {
  position: relative;
  width: 100%;
  background: #000;
  display: flex;
  justify-content: center;
}

.player-container {
  width: 100%;
  max-width: 1100px;
  aspect-ratio: 16/9;
  position: relative;
}

.player-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.no-video {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--dark-gray);
  color: var(--text-muted);
  gap: 12px;
}

.no-video i {
  font-size: 2.5rem;
  color: var(--text-muted);
}

.no-video p {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.no-video span {
  font-size: 0.85rem;
}

.watch-meta {
  background: var(--dark-gray);
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
}

.watch-meta .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.watch-meta .left h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.watch-meta .left p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.watch-meta .right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dub-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--medium-gray);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: var(--transition);
}

.dub-toggle.active {
  background: rgba(124, 58, 237, 0.15);
  border-color: var(--purple);
  color: var(--purple-light);
}

.watch-episodes {
  background: var(--dark-gray);
  padding: 24px 0;
  flex: 1;
}

.watch-episodes .episode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 8px;
}

.watch-episodes .episode-grid .ep-btn {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.watch-episodes .episode-grid .ep-btn:hover {
  border-color: var(--dark-purple);
  color: var(--text-primary);
}

.watch-episodes .episode-grid .ep-btn.active {
  background: var(--purple);
  border-color: var(--purple);
  color: white;
}

/* Footer */
.footer {
  background: var(--dark-gray);
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
}

.footer p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer .footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
}

.footer .footer-links a {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

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

/* Responsive */
@media (max-width: 768px) {
  .header .container {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 0;
    gap: 12px;
  }

  .nav {
    gap: 16px;
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .header-actions {
    order: 4;
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
  }

  .search-box {
    width: 100%;
  }

  .nav-right-items {
    justify-content: center;
    flex-wrap: wrap;
  }

  .admin-form .form-row {
    flex-direction: column;
  }

  .admin-table {
    font-size: 0.85rem;
  }

  .admin-actions {
    flex-direction: column;
    gap: 4px;
  }

  .hero h1 {
    font-size: 2rem;
  }

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

  .featured-card {
    height: 300px;
  }

  .featured-card .featured-info {
    padding: 20px;
  }

  .featured-card .featured-info h2 {
    font-size: 1.3rem;
  }

  .anime-detail-header {
    min-height: auto;
    padding-top: 0;
  }

  .anime-detail-header .detail-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-top: 80px;
  }

  .anime-detail-header .cover {
    width: 160px;
  }

  .anime-detail-header .detail-info .meta-list,
  .anime-detail-header .detail-info .genres {
    justify-content: center;
  }

  .anime-detail-header .detail-info .description {
    max-width: 100%;
    margin: 0 auto;
  }

  .episode-list {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }

  .watch-meta .container {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
}

/* Progress Bar Small (Card) */
.progress-bar-sm {
  height: 3px;
  background: var(--medium-gray);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}

.progress-fill-sm {
  height: 100%;
  background: var(--purple);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.progress-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Series Progress (Detail) */
.series-progress {
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--medium-gray);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.series-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.series-progress-header i {
  color: var(--purple-light);
  margin-right: 6px;
}

.progress-bar {
  height: 6px;
  background: var(--card-bg);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--purple-light));
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Watched Episode Indicators */
.episode-item.watched {
  border-color: rgba(124, 58, 237, 0.3);
  background: rgba(124, 58, 237, 0.08);
}

.episode-item.watched .ep-num {
  color: var(--purple-light);
}

.ep-check {
  position: absolute;
  top: 6px;
  right: 6px;
  color: var(--purple-light);
  font-size: 0.75rem;
}

.episode-item {
  position: relative;
}

/* Player Overlay */
.player-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 10;
}

.overlay-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  pointer-events: auto;
  opacity: 0;
}

.player-wrapper:hover .overlay-nav {
  opacity: 1;
}

.overlay-nav:hover {
  background: var(--purple);
}

.overlay-nav.prev {
  left: 16px;
}

.overlay-nav.next {
  right: 16px;
}

/* Episode Dots */
.episode-dots {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  overflow-x: auto;
  z-index: 10;
  justify-content: center;
  flex-wrap: wrap;
}

.episode-dots::-webkit-scrollbar {
  height: 3px;
}

.episode-dots::-webkit-scrollbar-thumb {
  background: var(--purple);
  border-radius: 2px;
}

.ep-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.5);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  flex-shrink: 0;
}

.ep-dot:hover {
  border-color: var(--purple-light);
  color: white;
}

.ep-dot.active {
  background: var(--purple);
  border-color: var(--purple);
  color: white;
}

.ep-dot.watched {
  border-color: var(--purple-light);
  color: var(--purple-light);
}

/* Mark Watched Button */
.mark-watched-btn {
  color: var(--text-secondary) !important;
  border-color: var(--border) !important;
}

.mark-watched-btn.watched {
  background: rgba(124, 58, 237, 0.15) !important;
  border-color: var(--purple) !important;
  color: var(--purple-light) !important;
}

/* Episode Grid Watched */
.ep-btn.watched {
  border-color: rgba(124, 58, 237, 0.3);
  color: var(--purple-light);
}

.ep-btn-check {
  display: block;
  font-size: 0.65rem;
  margin-top: 4px;
  color: var(--purple-light);
}

/* Search Filters */
.search-filters {
  margin-bottom: 32px;
}

.search-filters-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-group {
  flex: 1;
  min-width: 140px;
}

.filter-group-search {
  flex: 2;
  min-width: 200px;
}

.filter-group input,
.filter-group select {
  width: 100%;
  padding: 10px 14px;
  background: var(--medium-gray);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.filter-group input:focus,
.filter-group select:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.filter-group select {
  cursor: pointer;
}

.filter-group select option {
  background: var(--dark-gray);
  color: var(--text-primary);
}

#search-btn {
  height: 42px;
  white-space: nowrap;
}

/* Search Info */
.search-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 32px;
  padding: 16px 0;
}

.pagination span {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.pagination .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Nav icon styling */
.nav a i {
  font-size: 1.1rem;
}

@media (max-width: 768px) {
  .search-filters-row {
    flex-direction: column;
  }

  .filter-group {
    min-width: 100%;
  }

  .overlay-nav {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .episode-dots {
    justify-content: flex-start;
    flex-wrap: nowrap;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .anime-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero h1 {
    font-size: 1.6rem;
  }

  .section-title {
    font-size: 1.2rem;
  }

  .featured-card .featured-info h2 {
    font-size: 1.1rem;
  }
}
