/* ── Reset & base ────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  background: #eef2f7;
  color: #1a1a2e;
  min-height: 100vh;
  padding: 2.5rem 1rem 4rem;
}

.page-shell {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
}

.page-topbar {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 0.9rem;
}

.language-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid #d7dee5;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 4px 16px rgba(20, 28, 60, 0.08);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.language-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #455a64;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.language-buttons {
  display: inline-flex;
  gap: 0.35rem;
}

.lang-btn {
  min-width: 56px;
  padding: 0.42rem 0.85rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #546e7a;
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.lang-btn:hover {
  border-color: #c5d0da;
  color: #1a1a2e;
}

.lang-btn.active {
  background: #3949ab;
  color: #fff;
  box-shadow: 0 4px 14px rgba(57, 73, 171, 0.25);
}

/* ── Card container ──────────────────────────────────────────────────────── */
.container {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 6px 32px rgba(0, 0, 0, 0.10);
  padding: 2.75rem 2.5rem;
  width: 100%;
  max-width: 620px;
}

h1 {
  text-align: center;
  font-size: 1.75rem;
  font-weight: 700;
  color: #1a237e;
  letter-spacing: -0.4px;
  margin-bottom: 2rem;
}

/* ── Form groups ─────────────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1.25rem;
}

label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #37474f;
}

.required {
  color: #e53935;
  margin-left: 2px;
}

.hint {
  font-size: 0.82rem;
  color: #78909c;
  margin-top: -0.125rem;
}

/* ── Inputs & textarea ───────────────────────────────────────────────────── */
input[type='text'],
input[type='email'],
input[type='date'],
textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  font-size: 0.97rem;
  font-family: inherit;
  background: #f8fafc;
  border: 1.5px solid #cfd8dc;
  border-radius: 8px;
  color: #1a1a2e;
  transition: border-color 0.18s, box-shadow 0.18s;
  appearance: none;
}

input:focus,
textarea:focus {
  outline: none;
  background: #fff;
  border-color: #3949ab;
  box-shadow: 0 0 0 3px rgba(57, 73, 171, 0.12);
}

textarea {
  resize: vertical;
  min-height: 88px;
}

/* ── Signature area ──────────────────────────────────────────────────────── */
.signature-group {
  margin-top: 0.5rem;
}

.signature-wrapper {
  position: relative;
  width: 100%;
  height: 185px;
  border: 2px dashed #b0bec5;
  border-radius: 10px;
  background: #f8fafc;
  overflow: hidden;
  cursor: crosshair;
  /* prevent the browser from capturing touch events for scrolling */
  touch-action: none;
}

.signature-wrapper canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.signature-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

/* ── Inline field error ──────────────────────────────────────────────────── */
.field-error {
  font-size: 0.82rem;
  color: #c62828;
  margin-top: 0.25rem;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
  display: block;
  width: 100%;
  padding: 0.875rem;
  margin-top: 1.75rem;
  background: #3949ab;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.18s, transform 0.1s, box-shadow 0.18s;
  letter-spacing: 0.2px;
}

.btn-primary:hover:not(:disabled) {
  background: #283593;
  box-shadow: 0 4px 14px rgba(40, 53, 147, 0.28);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.985);
}

.btn-primary:disabled {
  background: #9fa8da;
  cursor: not-allowed;
}

.btn-secondary {
  padding: 0.42rem 1rem;
  background: transparent;
  color: #546e7a;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1.5px solid #cfd8dc;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-secondary:hover {
  background: #f0f4f8;
  color: #1a1a2e;
}

/* ── Status banner ───────────────────────────────────────────────────────── */
.status {
  margin-top: 1.25rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 500;
  text-align: center;
}

.status.hidden {
  display: none;
}

.status.success {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.status.error {
  background: #ffebee;
  color: #b71c1c;
  border: 1px solid #ef9a9a;
}

/* ── Utility ─────────────────────────────────────────────────────────────── */
.hidden {
  display: none !important;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  body {
    padding-top: 1.25rem;
  }

  .page-topbar {
    margin-bottom: 0.7rem;
  }

  .language-switch {
    width: 100%;
    justify-content: space-between;
  }

  .container {
    padding: 1.75rem 1.25rem;
  }

  h1 {
    font-size: 1.4rem;
  }

  .signature-wrapper {
    height: 150px;
  }
}
