/**
 * AniWorld - Modal Styles
 *
 * Modal and overlay styles including
 * config modal and confirmation dialogs.
 */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  position: relative;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-elevated);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  /* overflow:hidden removed — it was clipping the modal-body scrollbar.
     Border-radius clips backgrounds correctly without it on modern browsers. */
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--color-border);
}

.modal-header h3 {
  margin: 0;
  font-size: var(--font-size-subtitle);
  color: var(--color-text-primary);
}

.modal-body {
  padding: var(--spacing-lg);
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* Config Section within modals */
.config-section {
  border-top: 1px solid var(--color-divider);
  margin-top: var(--spacing-lg);
  padding-top: var(--spacing-lg);
}

.config-section h4 {
  margin: 0 0 var(--spacing-md) 0;
  font-size: var(--font-size-subtitle);
  font-weight: 600;
  color: var(--color-text-primary);
}

/* Scheduler info box */
.scheduler-info {
  background: var(--color-background-subtle);
  border-radius: var(--border-radius);
  padding: var(--spacing-md);
  margin: var(--spacing-sm) 0;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-xs);
}

.info-row:last-child {
  margin-bottom: 0;
}

.info-value {
  font-weight: 500;
  color: var(--color-text-secondary);
}

/* Status badge */
.status-badge {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: var(--font-size-caption);
  font-weight: 600;
}

.status-badge.running {
  background: var(--color-accent);
  color: white;
}

.status-badge.stopped {
  background: var(--color-text-disabled);
  color: white;
}

/* Rescan time config */
#rescan-time-config {
  margin-left: var(--spacing-lg);
  opacity: 0.6;
  transition: opacity var(--animation-duration-normal) var(--animation-easing-standard);
}

#rescan-time-config.enabled {
  opacity: 1;
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.loading-spinner {
  text-align: center;
  color: white;
}

.loading-spinner i {
  font-size: 48px;
  margin-bottom: var(--spacing-md);
}

.loading-spinner p {
  margin: 0;
  font-size: var(--font-size-subtitle);
}

/* Backup list */
.backup-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  margin: 8px 0;
}

.backup-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9em;
}

.backup-item:last-child {
  border-bottom: none;
}

.backup-info {
  flex: 1;
}

.backup-name {
  font-weight: 500;
  color: var(--text-color);
}

.backup-details {
  font-size: 0.8em;
  color: var(--muted-text);
  margin-top: 2px;
}

.backup-actions {
  display: flex;
  gap: 4px;
}

.backup-actions .btn {
  padding: 4px 8px;
  font-size: 0.8em;
}

/* Log files container */
.log-files-container {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px;
  margin-top: 8px;
}

.log-file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9em;
}

.log-file-item:last-child {
  border-bottom: none;
}

.log-file-info {
  flex: 1;
}

.log-file-name {
  font-weight: 500;
  color: var(--text-color);
}

.log-file-details {
  font-size: 0.8em;
  color: var(--muted-text);
  margin-top: 2px;
}

.log-file-actions {
  display: flex;
  gap: 4px;
}

.log-file-actions .btn {
  padding: 4px 8px;
  font-size: 0.8em;
  min-width: auto;
}

.log-file-actions .btn-xs {
  padding: 2px 6px;
  font-size: 0.75em;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .info-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

/* ============================================================================
   Context Menu
   ============================================================================ */

.context-menu {
  position: fixed;
  z-index: 1500;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-elevated);
  min-width: 180px;
  padding: var(--spacing-xs) 0;
  animation: contextMenuFadeIn 0.12s ease-out;
}

@keyframes contextMenuFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  cursor: pointer;
  color: var(--color-text-primary);
  font-size: var(--font-size-body);
  transition: background-color 0.1s ease;
}

.context-menu-item:hover {
  background-color: var(--color-hover);
}

.context-menu-item i {
  width: 16px;
  text-align: center;
  color: var(--color-text-secondary);
}

/* ============================================================================
   Edit Metadata Modal
   ============================================================================ */

.edit-modal-content {
  max-width: 520px;
}

.edit-section {
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-lg);
  border-bottom: 1px solid var(--color-divider);
}

.edit-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.edit-section h4 {
  margin: 0 0 var(--spacing-md) 0;
  font-size: var(--font-size-body);
  font-weight: 600;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.edit-section h4 i {
  color: var(--color-accent);
}

.form-group {
  margin-bottom: var(--spacing-md);
}

.form-group label {
  display: block;
  margin-bottom: var(--spacing-xs);
  font-size: var(--font-size-caption);
  font-weight: 500;
  color: var(--color-text-secondary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-md);
}

.field-error {
  display: block;
  margin-top: var(--spacing-xs);
  font-size: var(--font-size-caption);
  color: var(--color-error, #e74c3c);
}

.input-error {
  border-color: var(--color-error, #e74c3c) !important;
}

.key-warning {
  background: rgba(255, 193, 7, 0.1);
  border: 1px solid rgba(255, 193, 7, 0.3);
  border-radius: var(--border-radius);
  padding: var(--spacing-sm) var(--spacing-md);
  margin-top: var(--spacing-sm);
  font-size: var(--font-size-caption);
  color: var(--color-warning, #f39c12);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

/* NFO Diagnostics */
.nfo-diagnostics {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.nfo-status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: var(--font-size-caption);
  font-weight: 600;
  width: fit-content;
}

.nfo-status-badge.nfo-complete {
  background: rgba(46, 204, 113, 0.15);
  color: var(--color-success, #2ecc71);
}

.nfo-status-badge.nfo-incomplete {
  background: rgba(243, 156, 18, 0.15);
  color: var(--color-warning, #f39c12);
}

.nfo-status-badge.nfo-missing {
  background: rgba(231, 76, 60, 0.15);
  color: var(--color-error, #e74c3c);
}

.missing-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
  margin-top: var(--spacing-xs);
}

.missing-tag-chip {
  display: inline-block;
  padding: 2px 8px;
  background: var(--color-background-subtle);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: var(--font-size-caption);
  color: var(--color-text-secondary);
}

.nfo-all-good {
  color: var(--color-success, #2ecc71);
  font-size: var(--font-size-caption);
  margin: 0;
}

.nfo-error {
  color: var(--color-error, #e74c3c);
  font-size: var(--font-size-caption);
  margin: 0;
}

.repair-hint {
  font-size: var(--font-size-caption);
  color: var(--color-text-secondary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.btn-repair {
  align-self: flex-start;
  margin-top: var(--spacing-sm);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  padding: var(--spacing-md) var(--spacing-lg);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}


