/* ==========================================================================
   Calendario y Guía de Estrenos de Anime - Fijate.com
   Estándar Canónico Midnight Slate, Parrilla de Pósteres y Trailers
   ========================================================================== */

:root {
  --bg-primary: #0b0f17;
  --bg-surface: #121826;
  --bg-surface-elevated: #1a2336;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(255, 255, 255, 0.16);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-gold: #f59e0b;
  --accent-purple: #a855f7;
  --accent-purple-glow: rgba(168, 85, 247, 0.25);
  --accent-red: #ef4444;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 12px 32px -4px rgba(0, 0, 0, 0.6);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --border-color: #e2e8f0;
  --border-color-hover: #cbd5e1;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --shadow-card: 0 4px 16px -2px rgba(15, 23, 42, 0.06);
  --shadow-hover: 0 12px 28px -4px rgba(15, 23, 42, 0.12);
}

/* Base */
body {
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 0;
}

.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3.5rem;
  padding: 0 1rem;
  width: 100%;
  box-sizing: border-box;
}

.tool-with-sidebar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 1536px) {
  .tool-with-sidebar {
    grid-template-columns: 1fr 300px;
  }
}

.tool-main-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* Tarjeta de controles principales */
.card-main {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
}

.anime-controls-header {
  margin-bottom: 1.5rem;
}

.section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}

.section-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 0;
}

/* Selector de vistas principales */
.view-mode-tabs {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
}

.btn-view-tab {
  height: 44px;
  min-height: 40px;
  padding: 0 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-view-tab:hover {
  border-color: var(--accent-purple);
  color: var(--text-primary);
}

.btn-view-tab.active {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
  color: #ffffff;
  box-shadow: 0 0 12px var(--accent-purple-glow);
}

/* Días de la semana */
.days-schedule-row {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.btn-day-tab {
  height: 38px;
  min-height: 38px;
  padding: 0 1.1rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-day-tab:hover {
  border-color: var(--accent-gold);
  color: var(--text-primary);
}

.btn-day-tab.active {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #0b0f17;
  font-weight: 700;
}

/* Buscador y género */
.search-genre-bar {
  display: flex;
  gap: 1rem;
  flex-direction: column;
}

@media (min-width: 768px) {
  .search-genre-bar {
    flex-direction: row;
  }
}

.search-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.search-input-wrap svg {
  position: absolute;
  left: 1.1rem;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input-wrap .text-input {
  width: 100%;
  height: 44px;
  min-height: 40px;
  padding: 0 1rem 0 3rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.search-input-wrap .text-input:focus {
  border-color: var(--accent-purple);
}

.genre-filter-wrap {
  width: 100%;
  max-width: 240px;
}

@media (max-width: 767px) {
  .genre-filter-wrap {
    max-width: 100%;
  }
}

.custom-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 44px;
  min-height: 40px;
  padding: 0 2.2rem 0 1rem;
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
}

.custom-select option {
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
}

/* Parrilla de animes */
.anime-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 600px) {
  .anime-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 992px) {
  .anime-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Tarjeta individual de anime */
.anime-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.anime-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-color-hover);
  box-shadow: var(--shadow-hover);
}

.anime-poster-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #0f172a;
  overflow: hidden;
}

.anime-poster-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transition: transform 0.3s ease;
}

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

.anime-score-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(11, 15, 23, 0.88);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--accent-gold);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.anime-status-badge {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  background: rgba(11, 15, 23, 0.85);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
}

.anime-card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.6rem;
}

.anime-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.35;
}

.anime-english-title {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.anime-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.anime-studio {
  font-weight: 600;
  color: var(--accent-purple);
}

.anime-genres-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.genre-tag {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.anime-synopsis-box {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-secondary);
  background: var(--bg-surface-elevated);
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--accent-purple);
}

.anime-card-footer {
  margin-top: auto;
  display: flex;
  gap: 0.6rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.btn-play-trailer {
  flex: 1 1 0%;
  height: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: var(--accent-red);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: filter 0.2s;
}

.btn-play-trailer:hover {
  filter: brightness(1.1);
}

.btn-toggle-synopsis {
  height: 40px;
  min-height: 40px;
  padding: 0 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-toggle-synopsis:hover {
  border-color: var(--accent-purple);
  color: var(--accent-purple);
}

/* Modal de vídeo 16:9 */
.modal-box-video {
  max-width: 800px !important;
  padding: 1.25rem !important;
}

.video-aspect-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  background: #000000;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.video-aspect-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Modales */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  padding: 1rem;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  padding: 1.5rem;
  box-shadow: var(--shadow-hover);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.modal-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.modal-body {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.55;
  margin-bottom: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
}

.btn-primary {
  height: 42px;
  min-height: 40px;
  padding: 0 1.5rem;
  background: var(--accent-purple);
  border: none;
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}

/* Responsive móvil */
@media (max-width: 768px) {
  .card-main {
    padding: 1.25rem;
  }
}
