/* ==========================================================================
   MakerToolHub – Komponenten: Buttons, Badges, Karten, Formulare, FAQ, Code
   ========================================================================== */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 46px;
  padding: 0 22px;
  border: 1.5px solid transparent;
  border-radius: 10px;
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
}

.btn-primary {
  background: var(--green-800);
  border-color: var(--green-800);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--green-700);
  border-color: var(--green-700);
  color: var(--white);
}

.btn-secondary {
  background: var(--white);
  border-color: var(--green-800);
  color: var(--green-800);
}
.btn-secondary:hover {
  background: var(--green-50);
  color: var(--green-900);
}

.btn-accent {
  background: var(--orange-500);
  border-color: var(--orange-500);
  color: var(--ink);
}
.btn-accent:hover {
  background: var(--orange-600);
  border-color: var(--orange-600);
  color: var(--ink);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-soft);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--gray-100);
  color: var(--ink);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-sm {
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.9rem;
}

.btn-lg {
  min-height: 54px;
  padding: 0 28px;
  font-size: 1.05rem;
}

.btn-block {
  display: flex;
  width: 100%;
  white-space: normal;
}

/* Button, der wie ein Textlink aussieht */
.link-btn {
  padding: 0;
  background: none;
  border: 0;
  color: var(--green-700);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-btn:hover {
  color: var(--green-900);
}

/* Runder Icon-Button */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: none;
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: 50%;
  color: var(--ink-soft);
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.icon-btn:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.6;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge-demo  { background: var(--green-100); color: var(--green-800); }
.badge-later { background: var(--orange-100); color: var(--orange-900); }
.badge-soon  { background: var(--gray-100); color: var(--ink-muted); }

/* ---------- Karten ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

/* ---------- Icons (reines CSS, kein Bild nötig) ---------- */
.ico-check,
.ico-x {
  display: inline-block;
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  border-radius: 50%;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
}

.ico-check {
  background-color: var(--green-100);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Cpath d='M6 11.5l3.2 3.2L16 7.8' fill='none' stroke='%2314382b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.ico-x {
  background-color: #f6e4de;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Cpath d='M7 7l8 8M15 7l-8 8' fill='none' stroke='%23a04a35' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* ---------- Formulare ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field label,
.field .label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
}

.req {
  color: var(--orange-700);
  font-weight: 700;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="url"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  background: var(--white);
  border: 1.5px solid var(--gray-300);
  border-radius: 10px;
  font-size: 1rem; /* 16px verhindert Zoom auf iOS */
  line-height: 1.4;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

.field textarea {
  resize: vertical;
  min-height: 110px;
}

.field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1.5l6 6 6-6' fill='none' stroke='%235a6368' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--gray-400);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--green-700);
  box-shadow: 0 0 0 3px rgba(42, 102, 80, 0.25);
}

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: none;
}

.field [aria-invalid="true"] {
  border-color: var(--danger);
  background-color: #fffafa;
}

.field-error {
  color: var(--danger);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.4;
}
.field-error:empty {
  display: none;
}

/* Checkbox mit Beschriftung */
.check-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: var(--text-sm);
  font-weight: 400 !important;
  line-height: 1.55;
  cursor: pointer;
}

.check-label input[type="checkbox"] {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--green-800);
  cursor: pointer;
}

.check-label input[type="checkbox"]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.inline-note {
  color: var(--ink-muted);
  font-style: normal;
}

/* Honeypot (für Menschen unsichtbar) */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Hinweisbox beim Formular */
.form-notice {
  margin-top: var(--space-5);
  padding: var(--space-4);
  background: var(--orange-100);
  border-left: 4px solid var(--orange-500);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--orange-900);
  font-size: var(--text-sm);
}

/* Formular-Status */
.form-status {
  margin-top: var(--space-5);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: var(--text-sm);
}
.form-status:empty {
  display: none;
}
.form-status strong {
  display: block;
  margin-bottom: 2px;
}
.form-status.is-success { background: var(--success-bg); border-color: var(--green-200); color: var(--green-900); }
.form-status.is-error   { background: var(--danger-bg); border-color: #efc4ba; color: #7d2b1b; }
.form-status.is-warning { background: var(--orange-100); border-color: #f2d3ae; color: var(--orange-900); }
.form-status.is-info    { background: var(--info-bg); border-color: #cddbe9; color: var(--info); }

/* ---------- FAQ (details/summary) ---------- */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.faq-item {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

.faq-item[open] {
  border-color: var(--green-300);
  box-shadow: var(--shadow-sm);
}

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 18px 22px;
  font-weight: 600;
  color: var(--green-900);
  cursor: pointer;
  list-style: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "";
  flex: none;
  width: 12px;
  height: 12px;
  margin-right: 4px;
  border-right: 2.5px solid var(--green-700);
  border-bottom: 2.5px solid var(--green-700);
  transform: rotate(45deg);
  transition: transform var(--t-base) var(--ease);
}

.faq-item[open] summary::after {
  transform: rotate(-135deg);
}

.faq-item summary:focus-visible {
  outline-offset: -3px;
  border-radius: var(--radius-md);
}

.faq-answer {
  padding: 0 22px 20px;
  color: var(--ink-soft);
}
.faq-answer p:last-child {
  margin-bottom: 0;
}

/* ---------- Code-Darstellung ---------- */
.code-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-200);
}

.code-title {
  font-weight: 700;
  color: var(--green-900);
  font-size: var(--text-sm);
}

.code-block {
  margin: 0;
  padding: 22px 22px;
  background: var(--green-900);
  color: #d9efe3;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.75;
  overflow-x: auto;
  tab-size: 2;
}

.code-block code {
  font-family: inherit;
}

.code-note {
  margin: 0;
  padding: 14px 20px;
  color: var(--ink-muted);
  font-size: var(--text-xs);
}