/**
 * AniWorld - Index Page Styles
 *
 * Index/library page specific styles including
 * series grid, search, and scan overlay.
 */

/* Scan Progress Overlay */
.scan-progress-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.scan-progress-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.scan-progress-container {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-elevated);
  padding: var(--spacing-xxl);
  max-width: 450px;
  width: 90%;
  text-align: center;
  animation: scanProgressSlideIn 0.3s ease;
}

@keyframes scanProgressSlideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.scan-progress-header {
  margin-bottom: var(--spacing-lg);
}

.scan-progress-header h3 {
  margin: 0;
  font-size: var(--font-size-title);
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
}

.scan-progress-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--color-bg-tertiary);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: scanSpinner 1s linear infinite;
}

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

/* Progress bar for scan */
.scan-progress-bar-container {
  width: 100%;
  height: 8px;
  background-color: var(--color-bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: var(--spacing-sm);
}

.scan-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-hover, var(--color-accent)));
  border-radius: 4px;
  transition: width 0.3s ease;
}

.scan-progress-container.completed .scan-progress-bar {
  background: linear-gradient(90deg, var(--color-success), var(--color-success));
}

.scan-progress-text {
  font-size: var(--font-size-body);
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-md);
}

.scan-progress-text #scan-current-count {
  font-weight: 600;
  color: var(--color-accent);
}

.scan-progress-text #scan-total-count {
  font-weight: 600;
  color: var(--color-text-primary);
}

.scan-progress-container.completed .scan-progress-text #scan-current-count {
  color: var(--color-success);
}

.scan-progress-stats {
  display: flex;
  justify-content: space-around;
  margin: var(--spacing-lg) 0;
  padding: var(--spacing-md) 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.scan-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-xs);
}

.scan-stat-value {
  font-size: var(--font-size-large-title);
  font-weight: 600;
  color: var(--color-accent);
  line-height: 1;
}

.scan-stat-label {
  font-size: var(--font-size-caption);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.scan-current-directory {
  margin-top: var(--spacing-md);
  padding: var(--spacing-sm) var(--spacing-md);
  background-color: var(--color-bg-secondary);
  border-radius: var(--border-radius-md);
  font-size: var(--font-size-caption);
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.scan-current-directory-label {
  font-weight: 500;
  color: var(--color-text-tertiary);
  margin-right: var(--spacing-xs);
}

/* Scan completed state */
.scan-progress-container.completed .scan-progress-spinner {
  display: none;
}

.scan-progress-container.completed .scan-progress-header h3 {
  color: var(--color-success);
}

.scan-completed-icon {
  display: none;
  width: 24px;
  height: 24px;
  color: var(--color-success);
}

.scan-progress-container.completed .scan-completed-icon {
  display: inline-block;
}

.scan-progress-container.completed .scan-stat-value {
  color: var(--color-success);
}

.scan-elapsed-time {
  margin-top: var(--spacing-md);
  font-size: var(--font-size-body);
  color: var(--color-text-secondary);
}

.scan-elapsed-time i {
  margin-right: var(--spacing-xs);
  color: var(--color-text-tertiary);
}

/* Responsive adjustments for scan overlay */
@media (max-width: 768px) {
  .scan-progress-container {
    padding: var(--spacing-lg);
    max-width: 95%;
  }

  .scan-progress-stats {
    flex-direction: column;
    gap: var(--spacing-md);
  }

  .scan-stat {
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
    padding: 0 var(--spacing-md);
  }

  .scan-stat-value {
    font-size: var(--font-size-title);
  }
}

/* ============================================================
   Scheduler day-of-week toggle pills
   ============================================================ */

.scheduler-days-container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-sm);
}

.scheduler-day-toggle-label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

/* Hide the raw checkbox visually */
.scheduler-day-toggle-label .scheduler-day-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* Pill styling */
.scheduler-day-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.6rem;
  padding: var(--spacing-xs) var(--spacing-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-xl);
  font-size: var(--font-size-caption);
  font-weight: 600;
  color: var(--color-text-secondary);
  background-color: var(--color-bg-secondary);
  transition: background-color var(--transition-duration) var(--transition-easing),
              color var(--transition-duration) var(--transition-easing),
              border-color var(--transition-duration) var(--transition-easing);
  cursor: pointer;
}

/* Checked state – filled accent */
.scheduler-day-checkbox:checked + .scheduler-day-label {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  color: #ffffff;
}

/* Hover for unchecked */
.scheduler-day-toggle-label:hover .scheduler-day-label {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* Hover for checked */
.scheduler-day-toggle-label:hover .scheduler-day-checkbox:checked + .scheduler-day-label {
  background-color: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: #ffffff;
}

/* Dark theme overrides */
[data-theme="dark"] .scheduler-day-label {
  border-color: var(--color-border-dark);
  color: var(--color-text-secondary-dark);
  background-color: var(--color-bg-secondary-dark);
}

[data-theme="dark"] .scheduler-day-checkbox:checked + .scheduler-day-label {
  background-color: var(--color-accent-dark);
  border-color: var(--color-accent-dark);
  color: var(--color-bg-primary-dark);
}

[data-theme="dark"] .scheduler-day-toggle-label:hover .scheduler-day-label {
  border-color: var(--color-accent-dark);
  color: var(--color-accent-dark);
}

/* Next run display */
#scheduler-next-run {
  font-style: italic;
  font-size: var(--font-size-caption);
  color: var(--color-text-tertiary);
}

[data-theme="dark"] #scheduler-next-run {
  color: var(--color-text-tertiary-dark);
}

/* Advanced/collapsible section */
.config-advanced {
  font-size: var(--font-size-caption);
  color: var(--color-text-secondary);
  margin-top: var(--spacing-sm);
}

.config-advanced summary {
  cursor: pointer;
  padding: var(--spacing-xs) 0;
  font-weight: 500;
}

/* Responsive: wrap day pills to 2 rows on mobile */
@media (max-width: 480px) {
  .scheduler-days-container {
    gap: var(--spacing-xs);
  }

  .scheduler-day-label {
    min-width: 2.2rem;
    padding: var(--spacing-xs);
  }
}
