/* ── Schedules Management Panel ── */

.sched-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.sched-panel {
  width: min(680px, 90vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: rgba(20, 20, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

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

/* Header */
.sched-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sched-panel-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-text-primary, #fff);
  margin: 0;
}

.sched-panel-close {
  background: none;
  border: none;
  color: var(--color-text-secondary, #94A3B8);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.sched-panel-close:hover {
  color: #fff;
}

/* Filter tabs */
.sched-panel-filters {
  display: flex;
  gap: 2px;
  padding: 10px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.sched-panel-tab {
  background: none;
  border: none;
  color: var(--color-text-secondary, #94A3B8);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sched-panel-tab:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.sched-panel-tab--active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* List */
.sched-panel-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sched-panel-empty {
  text-align: center;
  color: var(--color-text-secondary, #94A3B8);
  font-size: 0.85rem;
  padding: 40px 0;
}

/* Row */
.sched-panel-row {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s ease;
}

.sched-panel-row:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.sched-panel-row--paused {
  opacity: 0.6;
}

/* Row top */
.sched-panel-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sched-panel-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sched-panel-type {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--color-text-secondary, #94A3B8);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.sched-panel-type--recurring {
  color: #A78BFA;
  border-color: rgba(167, 139, 250, 0.3);
}

.sched-panel-type--once {
  color: #60A5FA;
  border-color: rgba(96, 165, 250, 0.3);
}

.sched-panel-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-primary, #fff);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Row mid */
.sched-panel-row-mid {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.sched-panel-timing {
  font-size: 0.78rem;
  color: var(--color-text-secondary, #94A3B8);
  font-family: 'JetBrains Mono', monospace;
}

.sched-panel-next {
  font-size: 0.78rem;
  color: var(--color-text-secondary, #94A3B8);
}

.sched-panel-dots {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.sched-panel-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: #fff;
}

/* Actions */
.sched-panel-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.sched-panel-btn {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-text-secondary, #94A3B8);
  cursor: pointer;
  transition: all 0.15s ease;
}

.sched-panel-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sched-panel-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.sched-panel-btn--primary {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.3);
  color: #60A5FA;
}

.sched-panel-btn--primary:hover {
  background: rgba(59, 130, 246, 0.25);
  color: #93BBFD;
}

.sched-panel-btn--toggle {
  background: rgba(167, 139, 250, 0.1);
  border-color: rgba(167, 139, 250, 0.25);
  color: #A78BFA;
}

.sched-panel-btn--toggle:hover {
  background: rgba(167, 139, 250, 0.2);
}

.sched-panel-btn--danger {
  color: #F87171;
  border-color: rgba(248, 113, 113, 0.2);
}

.sched-panel-btn--danger:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* History toggle */
.sched-panel-history-toggle {
  background: none;
  border: none;
  color: var(--color-text-secondary, #64748B);
  font-size: 0.72rem;
  cursor: pointer;
  padding: 2px 0;
  text-align: left;
}

.sched-panel-history-toggle:hover:not(:disabled) {
  color: #fff;
}

.sched-panel-history-toggle:disabled {
  cursor: default;
  opacity: 0.5;
}

/* History section */
.sched-panel-history {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.sched-panel-history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--color-text-secondary, #94A3B8);
}

.sched-panel-history-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #64748B;
}

.sched-panel-history-dot--triggered {
  background: #22C55E;
}

.sched-panel-history-dot--manual {
  background: #3B82F6;
}

.sched-panel-history-dot--error {
  background: #EF4444;
}
