:root {
  --bg: #0f1117;
  --bg-panel: #161b27;
  --bg-card: #1e293b;
  --bg-card-hover: #212840;
  --bg-input: #111827;
  --border: #2a3347;
  --border-light: #334155;

  --accent: #7c5cfc;
  --accent-hover: #9579ff;

  --success: #22c55e;
  --success-dim: rgba(34, 197, 94, 0.12);
  --error: #ef4444;
  --error-dim: rgba(239, 68, 68, 0.12);
  --warn: #f59e0b;
  --warn-dim: rgba(245, 158, 11, 0.12);

  --text-primary: #e2e8f0;
  --text-secondary: #8b95a8;
  --text-muted: #4d5873;

  --font-display: "Syne", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
  --radius: 10px;
  --radius-sm: 6px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-display);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

.hidden {
  display: none !important;
}

/* HEADER */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.1rem;
}

.header-nav {
  display: flex;
  gap: 4px;
}

.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.nav-link.active {
  color: var(--text-primary);
  background: var(--bg-card);
}

/* LAYOUT */
.container {
  padding: 24px;
  max-width: 1300px;
  margin: 0 auto;
}

.main {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

@media (max-width: 860px) {
  .main {
    flex-direction: column;
  }
}

/* JOBS SECTION */
.jobs-section {
  flex: 2;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.section-header {
  display: flex;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.section-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* BUTTONS */
.btn {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-card);
}

/* JOB LIST */
#jobsContainer {
  padding: 16px 20px;
}

/* =========================
   MEMBER 3 FORM STYLING
   ========================= */

.form-section {
  flex: 1;
  min-width: 300px;
  background: var(--bg-panel);
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.form-section h2 {
  margin-bottom: 15px;
}

.job-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.job-form input,
.job-form select {
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
}

.job-form input::placeholder {
  color: var(--text-secondary);
}

.btn-primary {
  padding: 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

#message {
  margin-top: 10px;
  font-size: 14px;
}

/* =========================
   AI CRON GENERATOR STYLES
   ========================= */

.ai-generator-section {
  margin-top: 24px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.ai-header {
  margin-bottom: 20px;
}

.ai-header h2 {
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.ai-generator {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-input-group {
  display: flex;
  gap: 12px;
}

.ai-input-group input {
  flex: 1;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 0.9rem;
}

.ai-input-group input::placeholder {
  color: var(--text-secondary);
}

.btn-generate {
  padding: 12px 24px;
  white-space: nowrap;
  font-weight: 600;
}

.btn-generate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-loader {
  display: inline-block;
}

.ai-error-banner {
  background: var(--error-dim);
  color: var(--error);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--error);
  font-size: 0.85rem;
}

.ai-result-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  animation: fadeIn 0.3s ease-in;
}

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

.ai-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.ai-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.ai-badge-success {
  background: var(--success-dim);
  color: var(--success);
}

.ai-badge-caution {
  background: var(--warn-dim);
  color: var(--warn);
}

.ai-badge-unsafe {
  background: var(--error-dim);
  color: var(--error);
}

.ai-confidence {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.ai-cron-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-input);
  padding: 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--accent);
  border: 1px solid var(--border-light);
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.15s;
  color: var(--text-primary);
}

.btn-icon:hover {
  background: var(--bg-card);
  border-color: var(--accent);
}

.ai-explanation {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin: 12px 0;
  line-height: 1.5;
}

.ai-next-runs {
  margin: 12px 0;
  font-size: 0.82rem;
}

.ai-next-runs .label {
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

.ai-next-times {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.ai-warnings {
  background: var(--warn-dim);
  color: var(--warn);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--warn);
  font-size: 0.85rem;
  margin: 12px 0;
}

.ai-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  justify-content: flex-start;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
}

@media (max-width: 860px) {
  .ai-input-group {
    flex-direction: column;
  }

  .ai-cron-display {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }
}
