/* ==========================================================================
   Klass360 – Forms & Book-a-Demo popup
   1. Form fields   2. Choice chips   3. Success state   4. Modal (dialog)
   5. Contact form card
   ========================================================================== */

/* ---------- 1. Form fields ---------- */
.form { display: grid; gap: var(--space-5); }
.form__grid { display: grid; gap: var(--space-4); }
.field { display: grid; gap: 6px; min-width: 0; border: 0; }
.field--full { grid-column: 1 / -1; }
.field__label { color: var(--c-heading); font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.field__label span { color: #C2536B; }
.field__input {
  width: 100%;
  min-height: 48px;
  padding: 0.7rem 0.95rem;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  color: var(--c-heading);
  font-size: 16px; /* prevents iOS zoom */
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
textarea.field__input { min-height: 120px; resize: vertical; }
select.field__input {
  appearance: none;
  padding-right: 2.5rem;
  background: var(--c-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23064E6A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.85rem center / 18px;
}
.field__input::placeholder { color: var(--c-text-light); }
.field__input:focus { border-color: var(--c-primary-hover); box-shadow: 0 0 0 4px rgba(150, 207, 0, 0.22); }
.field--error .field__input { border-color: #C2536B; box-shadow: 0 0 0 4px rgba(194, 83, 107, 0.12); }
.field__error { min-height: 0; color: #B2425B; font-size: var(--fs-xs); }
.field__error:empty { display: none; }

.form__foot { display: grid; gap: var(--space-3); }
.form__foot .btn { width: 100%; }
.form__note { color: var(--c-text-light); font-size: var(--fs-xs); line-height: 1.5; }
.form__status { color: #B2425B; font-size: var(--fs-sm); }
.form__status:empty { display: none; }
.form.is-sending button[type="submit"] { opacity: 0.6; pointer-events: none; }

@media (min-width: 576px) {
  .form__grid { grid-template-columns: repeat(2, 1fr); }
  .form__foot { grid-template-columns: auto 1fr; align-items: center; gap: var(--space-5); }
  .form__foot .btn { width: auto; }
}

/* ---------- 2. Choice chips (checkbox pills) ---------- */
.field--choices { padding: 0; }
.field--choices legend { margin-bottom: var(--space-3); }
.choices { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-pill);
  background: var(--c-surface);
  color: var(--c-heading);
  font-size: var(--fs-sm);
  transition: background var(--t-fast), border-color var(--t-fast);
}
.choice:hover span { border-color: var(--c-secondary); }
.choice input:checked + span { background: var(--c-secondary); border-color: var(--c-secondary); color: #fff; }
.choice input:checked + span::before { content: "✓"; color: var(--c-primary); font-weight: 700; }
.choice input:focus-visible + span { outline: 2px solid var(--c-primary); outline-offset: 2px; }

/* ---------- 3. Success state ---------- */
.form-success { display: grid; justify-items: start; gap: var(--space-4); padding: var(--space-6) 0; }
.form-success[hidden] { display: none; }
.form-success__icon {
  display: grid; place-items: center;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--c-primary);
  color: var(--c-heading);
  animation: pop 0.5s var(--ease);
}
.form-success__icon .icon { width: 30px; height: 30px; stroke-width: 3; }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- 4. Modal ---------- */
body.modal-open { overflow: hidden; }
.modal {
  width: min(100% - 1.5rem, 1000px);
  max-width: none;
  max-height: calc(100dvh - 1.5rem);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--r-xl);
  background: var(--c-surface);
  color: var(--c-text);
  box-shadow: 0 40px 100px rgba(3, 24, 33, 0.35);
  overflow: auto;
  overscroll-behavior: contain;
}
.modal::backdrop { background: rgba(3, 24, 33, 0.62); backdrop-filter: blur(4px); }
.modal[open] { animation: modalIn 0.4s var(--ease); }
.modal[open]::backdrop { animation: fadeIn 0.3s ease; }
@keyframes modalIn { from { opacity: 0; transform: translateY(24px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal__inner { position: relative; display: grid; }
.modal__close {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 2;
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--c-bg);
  color: var(--c-heading);
  transition: background var(--t-fast), transform var(--t-fast);
}
.modal__close:hover { background: var(--c-primary); transform: rotate(90deg); }

.modal__aside {
  display: none;
  padding: var(--space-10) var(--space-8);
  background:
    radial-gradient(70% 50% at 100% 100%, rgba(150, 207, 0, 0.45), transparent 70%),
    radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px) 0 0 / 14px 14px,
    var(--c-secondary);
  color: var(--c-on-dark-muted);
}
.modal__aside-title { margin-bottom: var(--space-6); color: #fff; font-size: var(--fs-xl); font-weight: var(--fw-semibold); line-height: 1.3; }
.modal__aside .check-list { font-size: var(--fs-sm); }
.modal__contact { display: grid; gap: var(--space-2); margin-top: var(--space-10); padding-top: var(--space-6); border-top: 1px solid var(--c-on-dark-border); font-size: var(--fs-sm); }
.modal__contact a { display: inline-flex; align-items: center; gap: var(--space-2); color: #fff; font-weight: var(--fw-medium); }
.modal__contact a:hover { color: var(--c-primary); }
.modal__contact .icon { color: var(--c-primary); }

.modal__body { padding: var(--space-8) var(--space-5) var(--space-6); }
.modal__title { padding-right: var(--space-10); font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); letter-spacing: -0.02em; line-height: 1.2; }
.modal__lead { margin-top: calc(var(--space-3) * -1); font-size: var(--fs-sm); }

@media (min-width: 576px) {
  .modal__body { padding: var(--space-10) var(--space-8) var(--space-8); }
}
@media (min-width: 900px) {
  .modal__inner { grid-template-columns: 0.8fr 1.2fr; }
  .modal__aside { display: flex; flex-direction: column; }
  .modal__contact { margin-top: auto; }
}

/* ---------- 5. Contact form card ---------- */
.form-card {
  padding: var(--space-8) var(--space-5);
  border-radius: var(--r-xl);
  background: var(--c-surface);
  box-shadow: var(--shadow-md);
}
.form-card__title { font-size: var(--fs-xl); margin-bottom: var(--space-2); }
.form-card__lead { margin-bottom: var(--space-6); font-size: var(--fs-sm); }
@media (min-width: 768px) { .form-card { padding: var(--space-10); } }

/* Inline email forms (CTA / blog notify) */
.cta__form .field { min-width: 0; }
.cta__form .form__status { width: 100%; color: #FFB3B3; }
.cta__form .field__error { color: #FFB3B3; text-align: left; }
.cta__form .field--error .cta__input { border-color: #FF8A8A; }

/* Honeypot – hidden from people, visible to spam bots */
.hp-field { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }
