/* ═══════════════════════════════════════════════════════════════════════════
   sync.css  —  page-specific styles for the Sync page.
   Global helpers (settings-panel, section-note, panel-action-btn) in style.css.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Page intro (unpanelled) ─────────────────────────────────────────────── */

.sync-intro {
  margin-bottom: 1.5rem;
}

.sync-page-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.5rem;
  font-size: 1.65rem;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.82);
}

html.dark .sync-page-title {
  color: rgba(255, 255, 255, 0.9);
}

.sync-intro .ui.warning.floating.message {
  margin-bottom: 0.85rem;
}

/* ── Panel spacing ───────────────────────────────────────────────────────── */

.sync-intro + .sync-source-panel,
.sync-source-panel + .sync-source-panel {
  margin-top: 1.25rem;
}

.sync-add-btn {
  margin-left: auto;
}

/* ── Next scheduled run note ─────────────────────────────────────────────── */

.sync-schedule-note {
  margin: 0 0 0.85rem;
  font-size: 0.92em;
  color: rgba(0, 0, 0, 0.55);
}

html.dark .sync-schedule-note {
  color: rgba(255, 255, 255, 0.65);
}

.sync-schedule-note:empty {
  display: none;
  margin: 0;
}

/* ── Connection accent (left border on source panels) ────────────────────── */

.sync-source-panel--emby {
  --sync-accent: #4caf50;
}

.sync-source-panel--jellyfin {
  --sync-accent: rgb(108, 119, 199);
}

.sync-source-panel--plex {
  --sync-accent: rgb(226, 179, 61);
}

.sync-source-panel--sonarr {
  --sync-accent: rgb(92, 201, 250);
}

.sync-source-panel {
  border-left: 3px solid var(--sync-accent, rgba(99, 145, 210, 0.5));
}

/* ── Sync list ───────────────────────────────────────────────────────────── */

.sync-list:empty + .sync-empty-msg {
  display: block;
}

.sync-empty-msg {
  display: none;
  margin: 0;
  padding: 1.25rem 1rem;
  text-align: center;
  font-size: 0.9em;
  color: rgba(0, 0, 0, 0.4);
}

html.dark .sync-empty-msg {
  color: rgba(255, 255, 255, 0.38);
}

/* ── Sync row (.card kept for JS) ────────────────────────────────────────── */

.sync-row.card {
  max-width: none !important;
  width: 100%;
  margin: 0 !important;
  box-shadow: none !important;
  border-radius: 0;
  background: transparent;
}

.sync-row {
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

html.dark .sync-row {
  border-bottom-color: rgba(255, 255, 255, 0.05);
}

.sync-row:last-child {
  border-bottom: none;
}

.sync-row-content {
  padding: 0.75rem 1rem 0.85rem;
}

.sync-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.sync-row-title .header {
  font-size: 0.98em;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.85);
  margin: 0;
  line-height: 1.3;
}

html.dark .sync-row-title .header {
  color: rgba(255, 255, 255, 0.9);
}

.sync-meta {
  margin-top: 0.15rem;
  font-size: 0.78em;
  color: rgba(0, 0, 0, 0.42);
  letter-spacing: 0.02em;
}

html.dark .sync-meta {
  color: rgba(255, 255, 255, 0.38);
}

/* ── Row action buttons ──────────────────────────────────────────────────── */

.sync-row-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.sync-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.03);
  color: rgba(0, 0, 0, 0.55);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

/* Fomantic icon margins throw off centering inside square buttons */
.sync-action-btn i.icon {
  margin: 0;
  line-height: 1;
  width: 1em;
  height: 1em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

html.dark .sync-action-btn {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.55);
}

.sync-action-btn:hover:not(:disabled) {
  transform: scale(1.05);
}

.sync-action-btn--run:hover:not(:disabled) {
  background: rgba(33, 133, 208, 0.12);
  border-color: rgba(33, 133, 208, 0.35);
  color: #2185d0;
}

.sync-action-btn--edit:hover:not(:disabled) {
  background: rgba(46, 204, 64, 0.12);
  border-color: rgba(46, 204, 64, 0.35);
  color: #2ecc40;
}

.sync-action-btn--delete:hover:not(:disabled) {
  background: rgba(219, 40, 40, 0.1);
  border-color: rgba(219, 40, 40, 0.3);
  color: #db2828;
}

.sync-action-btn--details:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.07);
  border-color: rgba(0, 0, 0, 0.14);
  color: rgba(0, 0, 0, 0.72);
}

html.dark .sync-action-btn--details:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.88);
}

.sync-action-btn i.sync.icon.loading {
  margin: 0;
}

.sync-action-btn i.icon.disabled,
.sync-row .sync-action-btn--run:has(i.sync.disabled) {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Row loading state (delete in progress) */
.sync-row.card.loading {
  opacity: 0.65;
  pointer-events: none;
}

/* ── Expanded details panel ──────────────────────────────────────────────── */

.sync-details {
  margin-top: 0.55rem;
  padding: 0.65rem 0.75rem;
  background: rgba(0, 0, 0, 0.025);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 8px;
}

html.dark .sync-details {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.sync-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.5rem 1.25rem;
}

.sync-detail-item {
  font-size: 0.88em;
  line-height: 1.45;
  color: rgba(0, 0, 0, 0.78);
}

html.dark .sync-detail-item {
  color: rgba(255, 255, 255, 0.88);
}

.sync-detail-label {
  display: block;
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.4);
  margin-bottom: 0.1rem;
}

html.dark .sync-detail-label {
  color: rgba(255, 255, 255, 0.55);
}

.sync-detail-empty {
  margin: 0;
  font-size: 0.88em;
  color: rgba(0, 0, 0, 0.45);
  font-style: italic;
}

html.dark .sync-detail-empty {
  color: rgba(255, 255, 255, 0.65);
}
