/*!
 * Anime Watch History (AWH) — styles
 * Pairs with anime-watch-history.js. Only needs the container IDs
 * documented in the JS file's section headers.
 */

:root {
  --awh-accent: #2ecc71;
  --awh-accent-dark: #27ae60;
  --awh-bg-card: #1b1b1f;
  --awh-text: #e8e8e8;
  --awh-muted: #9a9a9a;
  --awh-radius: 10px;
}

/* ---------- Watched episode marking ---------- */
.episode.awh-watched .episode-number {
  color: var(--awh-accent);
}
.episode.awh-watched i.fa-check-circle {
  color: var(--awh-accent);
  animation: awh-pop 0.35s ease;
}
@keyframes awh-pop {
  0%   { transform: scale(0.4); opacity: 0; }
  70%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}

/* ---------- Continue Watching banner (on episode page) ---------- */
.awh-continue-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(90deg, var(--awh-accent-dark), var(--awh-accent));
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--awh-radius);
  margin: 0 0 16px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: awh-fade-in 0.25s ease;
}
.awh-continue-banner:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(46, 204, 113, 0.35);
}
.awh-continue-icon i { font-size: 1.2em; }

/* ---------- Watch History page ---------- */
.awh-history-page { max-width: 1200px; margin: 0 auto; padding: 20px; }
.awh-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.awh-clear-btn {
  background: #e74c3c;
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s ease;
}
.awh-clear-btn:hover { background: #c0392b; }

.awh-history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
}
.awh-history-card {
  position: relative;
  background: var(--awh-bg-card);
  border-radius: var(--awh-radius);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.25s ease, max-height 0.25s ease;
  animation: awh-fade-in 0.3s ease;
}
.awh-history-card:hover { transform: translateY(-4px); box-shadow: 0 8px 20px rgba(0,0,0,0.35); }
.awh-history-card.awh-removing {
  opacity: 0;
  transform: scale(0.9);
  pointer-events: none;
}
.awh-history-poster { display: block; aspect-ratio: 2/3; overflow: hidden; background: #333; }

/* Per-card remove ("x") button, top-right corner over the poster */
.awh-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.awh-history-card:hover .awh-remove-btn,
.awh-remove-btn:focus {
  opacity: 1;
  transform: scale(1);
}
.awh-remove-btn:hover { background: #e74c3c; }
/* Always visible on touch devices, since there's no hover state */
@media (hover: none) {
  .awh-remove-btn { opacity: 1; transform: scale(1); background: rgba(0, 0, 0, 0.55); }
}
.awh-history-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.awh-poster-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--awh-muted); font-size: 2em; }
.awh-history-info { padding: 12px; }
.awh-history-title { display: block; color: var(--awh-text); font-weight: 600; margin-bottom: 6px; text-decoration: none; }
.awh-history-title:hover { color: var(--awh-accent); }
.awh-history-episode { color: var(--awh-muted); font-size: 0.85em; margin: 0 0 2px; }
.awh-history-date { color: var(--awh-muted); font-size: 0.78em; margin: 0 0 10px; }
.awh-continue-btn {
  width: 100%;
  background: var(--awh-accent);
  color: #fff;
  border: none;
  padding: 8px 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s ease;
}
.awh-continue-btn:hover { background: var(--awh-accent-dark); }
.awh-empty { color: var(--awh-muted); text-align: center; padding: 40px 0; }

/* ---------- Confirm dialog ---------- */
.awh-confirm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 99999; padding: 16px;
}
.awh-confirm-box {
  background: #202024; color: var(--awh-text);
  padding: 22px; border-radius: var(--awh-radius);
  max-width: 360px; width: 100%; text-align: center;
  animation: awh-fade-in 0.2s ease;
}
@keyframes awh-fade-in { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.awh-confirm-actions { display: flex; gap: 10px; margin-top: 18px; }
.awh-confirm-actions button { flex: 1; padding: 10px; border: none; border-radius: 6px; cursor: pointer; font-weight: 600; }
.awh-confirm-cancel { background: #444; color: #fff; }
.awh-confirm-cancel:hover { background: #555; }
.awh-confirm-ok { background: #e74c3c; color: #fff; }
.awh-confirm-ok:hover { background: #c0392b; }

/* ---------- Homepage widget ---------- */
#awh-home-widget {
  background: var(--awh-bg-card);
  border-radius: var(--awh-radius);
  padding: 16px;
  margin: 20px 0;
}
.awh-widget-title { color: var(--awh-text); margin: 0 0 12px; font-size: 1.1em; }
.awh-widget-list { display: flex; flex-direction: column; gap: 10px; }
.awh-widget-item { position: relative; display: flex; align-items: center; gap: 10px; transition: opacity 0.25s ease, transform 0.25s ease; }
.awh-widget-item.awh-removing { opacity: 0; transform: translateX(8px); pointer-events: none; }
.awh-widget-poster { width: 42px; height: 58px; flex: none; border-radius: 6px; overflow: hidden; background: #333; display: block; }
.awh-widget-poster img { width: 100%; height: 100%; object-fit: cover; }
.awh-widget-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.awh-widget-title-link { color: var(--awh-text); text-decoration: none; font-size: 0.92em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.awh-widget-title-link:hover { color: var(--awh-accent); }
.awh-widget-ep { color: var(--awh-muted); font-size: 0.8em; }
.awh-widget-continue {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: var(--awh-accent); color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s ease;
}
.awh-widget-continue:hover { background: var(--awh-accent-dark); }
.awh-widget-remove {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255,255,255,0.08); color: var(--awh-muted); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 0.85em;
  transition: background 0.2s ease, color 0.2s ease;
}
.awh-widget-remove:hover { background: #e74c3c; color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .awh-history-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
  .awh-continue-banner { font-size: 0.92em; padding: 10px 14px; }
  .awh-history-header { flex-direction: column; align-items: flex-stretch; }
  .awh-clear-btn { width: 100%; }
}