/* Buttons */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-ghost {
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.1s;
}

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

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

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border-strong);
}

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

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-ghost {
  background: none;
  color: var(--text-soft);
}

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

.btn-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: flex-end;
}

.btn-small {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 4px 10px;
  font-size: 12px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.btn-small:hover { background: var(--bg-hover); }
.btn-small.btn-ghost { border-color: transparent; color: var(--text-soft); }
.btn-small.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.dia-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-soft, #e0f2fe);
  color: var(--accent, #0369a1);
  border-radius: 99px;
  padding: 3px 10px 3px 10px;
  font-size: 12px;
  white-space: nowrap;
}
.dia-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: inherit;
  padding: 0 0 0 2px;
  opacity: 0.7;
}
.dia-chip-remove:hover { opacity: 1; }

.btn-big {
  padding: 16px 24px;
  font-size: 14px;
}

.btn-row-quick {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

/* Alerts list */
.alerts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert-item {
  background: var(--warning-soft);
  border-left: 3px solid var(--warning);
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 13px;
}

.alert-item.danger {
  background: var(--danger-soft);
  border-left-color: var(--danger);
}

.alert-item.info {
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal {
  background: var(--bg);
  border-radius: 12px;
  padding: 24px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal h3 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
}

.modal-wide {
  max-width: 800px;
}

/* Error / info text */
.error-msg {
  background: var(--danger-soft);
  color: var(--danger);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-top: 12px;
}

.info-msg {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-top: 8px;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}

.toast {
  background: #000;
  color: white;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.2s ease-out;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

.toast.warning {
  background: var(--warning);
}

@keyframes slideIn {
  from {
    transform: translateX(20px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Filters bar */
.filters {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}

.filters label {
  white-space: nowrap;
  font-size: 13px;
  color: var(--text-soft);
  flex-shrink: 0;
}

.filters select,
.filters input {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* Code/markdown export */
.code-block {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 500px;
  overflow-y: auto;
}

/* Detail rows */
.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

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

.detail-row .label {
  color: var(--text-soft);
}

.detail-row .value {
  font-weight: 500;
}

/* Theme toggle button */
.btn-theme {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: opacity 0.2s, transform 0.2s;
  flex-shrink: 0;
  line-height: 1;
}

.btn-theme img {
  height: 36px;
  width: auto;
  display: block;
}

.btn-theme:hover {
  opacity: 0.85;
  transform: scale(1.05);
}

/* Canvas: never overflow their container */
canvas {
  max-width: 100%;
}

/* Botón link (sign out, etc.) */
.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  padding: 0;
  text-decoration: underline;
}

.btn-link:hover {
  color: var(--accent-hover);
}

