/* ═══════════════════════════════════════════════════════════════════════════
   MCC Component Library · Hermes Desktop Patterns port
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Button Variants (7 Varianten, 3 Sizes) ──────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all .12s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* Primary – gefuellt, accent */
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

/* Secondary – abgesetzt */
.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

/* Outline – transparent mit Border */
.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-outline:hover:not(:disabled) {
  background: var(--bg-hover);
}

/* Ghost – nur Textfarbe */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Danger – rot */
.btn-danger {
  background: var(--red);
  color: #fff;
}

/* Size: small */
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
}

/* Size: medium (default) */
.btn-md {
  padding: 6px 14px;
  font-size: 13px;
}

/* Size: large */
.btn-lg {
  padding: 8px 18px;
  font-size: 14px;
}


/* ─── Segmented Control (ersetzt Radio-Buttons) ───────────────────────── */

.segmented {
  display: inline-flex;
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.segmented button {
  padding: 4px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all .12s;
}
.segmented button:hover {
  color: var(--text-primary);
}
.segmented button.active {
  background: var(--bg-primary);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}


/* ─── Badge System (8 Status-Zustaende) ──────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

/* Status: green (connected, enabled) */
.badge-green {
  background: rgba(34,197,94,.15);
  color: var(--green);
}
.badge-green .badge-dot {
  background: var(--green);
}

/* Status: yellow (pending_restart) */
.badge-yellow {
  background: rgba(234,179,8,.15);
  color: var(--yellow);
}
.badge-yellow .badge-dot {
  background: var(--yellow);
}

/* Status: red (error, fatal, startup_failed) */
.badge-red {
  background: rgba(239,68,68,.15);
  color: var(--red);
}
.badge-red .badge-dot {
  background: var(--red);
}

/* Status: gray (disconnected, not_configured) */
.badge-gray {
  background: var(--bg-hover);
  color: var(--text-muted);
}
.badge-gray .badge-dot {
  background: var(--text-muted);
}

/* Status: disabled (lower opacity) */
.badge-gray.badge-disabled {
  opacity: .5;
}

/* Fatal: bolder styling */
.badge-red.badge-fatal {
  font-weight: 700;
}


/* ─── Overlay / Modal System ──────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-width: 400px;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-body {
  padding: 20px;
}
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}


/* ─── Form Elements ────────────────────────────────────────────────────── */

.input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .12s;
}
.input:focus {
  border-color: var(--accent);
}
.input::placeholder {
  color: var(--text-muted);
}

.select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: border-color .12s;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca0ab' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}
.select:focus {
  border-color: var(--accent);
}

.label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
  display: block;
}


/* ─── Form Layout ──────────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 14px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}


/* ─── Card Component ───────────────────────────────────────────────────── */

.card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}


/* ─── Toast System ─────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 9999;
  animation: slideUp .2s ease;
}
.toast-success {
  background: var(--green);
  color: #fff;
}
.toast-error {
  background: var(--red);
  color: #fff;
}
.toast-info {
  background: var(--accent);
  color: #fff;
}

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


/* ─── ScheduleBuilder ──────────────────────────────────────────────────── */

.schedule-builder {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.schedule-summary {
  background: rgba(124,111,247,.08);
  border: 1px solid rgba(124,111,247,.2);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 14px;
}


/* ─── Env-Key-Value Input (fuer Channels) ─────────────────────────────── */

.env-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.env-row .input {
  flex: 1;
}
.env-row .input:first-child {
  max-width: 180px;
  font-family: var(--omd-font-mono, ui-monospace, 'SF Mono', Menlo, monospace);
  font-size: 12px;
}
