/* Schedules - ACLBot v12.0 */

/* Schedule modals are scoped so this page stylesheet cannot restyle every panel modal. */
.schedule-modal-container {
  width: min(860px, calc(100vw - 32px));
  max-width: min(860px, calc(100vw - 32px));
  max-height: min(92vh, 920px);
  overflow-y: auto;
  border-radius: 10px;
}

.schedule-modal-content {
  padding: 24px;
}

.schedule-modal-content form,
.schedule-modal-content .schedule-modal-wide {
  margin: 0;
  width: 100%;
}

.schedule-modal-content .schedule-modal-wide {
  --bg-hover: var(--border-subtle);
  --bg-card: var(--bg-tertiary);
  --bg-overlay: var(--bg-tertiary);
}

.schedule-modal-content input[type="text"],
.schedule-modal-content input[type="number"],
.schedule-modal-content input:not([type]),
.schedule-modal-content select,
.schedule-modal-content textarea {
  width: 100%;
  min-width: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  box-sizing: border-box;
}

.schedule-modal-content textarea {
  min-height: 112px;
  resize: vertical;
}

.schedule-modal-content select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.schedule-modal-content input:focus,
.schedule-modal-content select:focus,
.schedule-modal-content textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
  outline: none;
}

.schedule-modal-content label {
  color: var(--text-secondary);
}

.schedule-modal-content button[type="submit"] {
  min-height: 42px;
  border-radius: 8px;
}

.schedule-modal-content .modal-footer-right,
.schedule-modal-content [class*="ButtonWrapper"] {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.schedule-modal-content [class*="ModeToggle"] {
  min-width: 0;
}

.schedule-modal-content [class*="ModeToggle"] button {
  min-width: 0;
  white-space: normal;
}

.schedule-modal-content [class*="PreviewValue"],
.schedule-modal-content [class*="PreviewLabel"] {
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .schedule-modal-container {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    border-radius: 8px;
  }

  .schedule-modal-content {
    padding: 18px;
  }

  .schedule-modal-content [class*="ModeToggle"] {
    flex-direction: column;
  }

  .schedule-modal-content [class*="ButtonWrapper"] {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .schedule-modal-content [class*="ButtonWrapper"] button,
  .schedule-modal-content button[type="submit"] {
    width: 100%;
  }
}
/* ============================================
   SCHEDULES PAGE - TÃ¢ches planifiÃ©es
   ============================================ */

.schedules-page {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* Header */
.schedules-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  flex-wrap: wrap;
}

[data-theme="dark"] .schedules-header {
  background: var(--border-subtle);
  border-color: var(--border);
}

.schedules-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.schedules-header-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-muted);
  color: var(--accent);
  border-radius: var(--radius-xl);
  font-size: var(--text-xl);
}

.schedules-header-title {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin: 0;
}

.schedules-header-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: var(--space-1) 0 0 0;
}

.schedules-create-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  background: var(--accent);
  border: none;
  border-radius: var(--radius-lg);
  color: white;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.schedules-create-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

/* Empty State */
.schedules-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16);
  text-align: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}

[data-theme="dark"] .schedules-empty {
  background: var(--border-subtle);
  border-color: var(--border);
}

.schedules-empty-icon {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
  background: var(--bg-tertiary);
  border-radius: var(--radius-2xl);
  color: var(--text-tertiary);
  font-size: var(--text-3xl);
}

[data-theme="dark"] .schedules-empty-icon {
  background: var(--bg-tertiary);
}

.schedules-empty-title {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin: 0 0 var(--space-2) 0;
}

.schedules-empty-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 0 var(--space-6) 0;
}

/* Schedules List */
.schedules-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Schedule Card */
.schedule-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.schedule-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateX(4px);
}

[data-theme="dark"] .schedule-card {
  background: var(--border-subtle);
  border-color: var(--border);
}

[data-theme="dark"] .schedule-card:hover {
  border-color: var(--accent);
}

.schedule-card-main {
  flex: 1;
  min-width: 0;
}

.schedule-card-top {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.schedule-card-name {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0;
}

.schedule-card-meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.schedule-card-meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.schedule-card-cron {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
}

[data-theme="dark"] .schedule-card-cron {
  background: var(--bg-tertiary);
}

/* Schedule Status */
.schedule-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-lg);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.schedule-status.active {
  background: var(--success-muted);
  color: var(--success);
}

.schedule-status.inactive {
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
}

.schedule-status.processing {
  background: var(--warning-muted);
  color: var(--warning);
  animation: pulse 2s ease-in-out infinite;
}

/* Schedule detail */
.schedule-detail {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.schedule-detail-header,
.schedule-tasks-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
}

[data-theme="dark"] .schedule-detail-header,
[data-theme="dark"] .schedule-tasks-section {
  background: var(--border-subtle);
}

.schedule-detail-header {
  padding: var(--space-5);
}

.schedule-detail-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.schedule-detail-title-group {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
}

.schedule-detail-icon {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: var(--accent);
  background: var(--accent-muted);
  border-radius: 8px;
}

.schedule-detail-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin: 0;
  color: var(--text-primary);
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.schedule-detail-actions,
.schedule-detail-footer,
.schedule-task-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.schedule-detail-dates {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--space-4);
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
}

.schedule-detail-date {
  min-width: 0;
}

.schedule-detail-date-label,
.schedule-cron-box-label {
  display: block;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0;
}

.schedule-detail-date-value {
  display: block;
  margin-top: var(--space-1);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
}

.schedule-detail-date-separator {
  width: 1px;
  background: var(--border);
}

.schedule-cron-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-3);
}

.schedule-cron-box {
  min-width: 0;
  padding: var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
}

[data-theme="dark"] .schedule-cron-box {
  background: var(--border-subtle);
}

.schedule-cron-box-value {
  margin-top: var(--space-2);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  overflow-wrap: anywhere;
}

.schedule-tasks-section {
  overflow: hidden;
}

.schedule-tasks-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}

.schedule-tasks-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  color: var(--text-primary);
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
}

.schedule-tasks-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 var(--space-2);
  color: var(--accent);
  background: var(--accent-muted);
  border-radius: 999px;
  font-size: var(--text-xs);
}

.schedule-tasks-empty {
  padding: var(--space-6);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  text-align: center;
}

.schedule-task-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}

.schedule-task-row:last-child {
  border-bottom: 0;
}

.schedule-task-icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.schedule-task-icon.command {
  color: var(--accent);
  background: var(--accent-muted);
}

.schedule-task-icon.power {
  color: var(--success);
  background: var(--success-muted);
}

.schedule-task-icon.backup {
  color: var(--purple);
  background: var(--purple-muted);
}

.schedule-task-info {
  min-width: 0;
}

.schedule-task-type {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
}

.schedule-task-payload {
  margin-top: var(--space-1);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  overflow-wrap: anywhere;
}

.schedule-task-badges {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.schedule-task-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 5px 8px;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
}

.schedule-task-badge.continue {
  color: var(--warning);
  background: var(--warning-muted);
}

.schedule-task-badge.delay {
  color: var(--accent);
  background: var(--accent-muted);
}

.schedule-task-action-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.schedule-task-action-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-muted);
}

.schedule-task-action-btn.delete:hover {
  color: var(--error);
  border-color: var(--error);
  background: var(--error-muted);
}

.schedule-detail-footer {
  justify-content: flex-end;
  padding-top: var(--space-2);
}

/* Responsive */
@media (max-width: 768px) {
  .schedules-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
  }
  .schedule-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
  }
  .schedule-card-top {
    flex-wrap: wrap;
  }
  .schedule-card-meta {
    gap: 4px;
  }

  .schedule-detail-header-top,
  .schedule-detail-title-group,
  .schedule-detail-actions,
  .schedule-detail-footer {
    width: 100%;
  }

  .schedule-detail-header-top {
    flex-direction: column;
  }

  .schedule-detail-actions,
  .schedule-detail-footer {
    justify-content: stretch;
  }

  .schedule-detail-actions > *,
  .schedule-detail-footer > * {
    flex: 1 1 auto;
  }

  .schedule-detail-dates {
    grid-template-columns: 1fr;
  }

  .schedule-detail-date-separator {
    width: 100%;
    height: 1px;
  }

  .schedule-cron-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .schedule-task-row {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: flex-start;
  }

  .schedule-task-badges,
  .schedule-task-actions {
    grid-column: 1 / -1;
  }

  .schedule-task-actions {
    justify-content: flex-end;
  }
}
