:root {
  --page-bg: #e8ecf1;
  --card-bg: #ffffff;
  --card-radius: 16px;
  --card-shadow: 0 8px 32px rgba(15, 23, 42, 0.08);

  --header-from: #8b0000;
  --header-to: #c41e3a;

  --info-bg: #e8f4fc;
  --info-border: #3b82c4;
  --info-text: #1e4a6e;

  --warn-bg: #fff8e6;
  --warn-border: #f0c674;
  --warn-text: #8a5a12;

  --contract-green: #2d8f4e;
  --contract-green-hover: #257a42;

  --submit-red: #c8102e;
  --submit-red-hover: #a50d26;

  --input-border: #d1d9e6;
  --input-radius: 10px;
  --text: #1a1a2e;
  --muted: #6b7280;
  --readonly-bg: #f3f4f6;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --space: clamp(0.75rem, 2vw, 1.25rem);
  --card-width: min(100% - 2rem, 480px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: clamp(0.9375rem, 2.5vw, 1rem);
  line-height: 1.5;
  color: var(--text);
  background: var(--page-bg);
}

.page {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100dvh;
  padding: clamp(1rem, 4vw, 2rem) 1rem;
}

.card {
  width: var(--card-width);
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.card__header {
  background: linear-gradient(180deg, var(--header-from) 0%, var(--header-to) 100%);
  padding: clamp(1.25rem, 4vw, 1.75rem) var(--space);
  text-align: center;
  color: #fff;
}

.card__brand {
  margin: 0;
  font-size: clamp(2rem, 8vw, 2.75rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.1;
}

.card__subtitle {
  margin: 0.5rem 0 0;
  font-size: clamp(0.65rem, 2.2vw, 0.75rem);
  font-weight: 600;
  letter-spacing: 0.12em;
  opacity: 0.95;
}

.card__body {
  padding: var(--space);
}

.alert {
  display: flex;
  gap: 0.625rem;
  align-items: flex-start;
  padding: 0.75rem 0.875rem;
  border-radius: 10px;
  margin-bottom: var(--space);
  font-size: 0.875rem;
  line-height: 1.45;
}

.alert--info {
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  color: var(--info-text);
}

.alert--warning {
  margin-top: 0.5rem;
  margin-bottom: 0;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn-text);
}

.alert__icon {
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1.4;
}

.alert__text {
  margin: 0;
}

.alert__text strong {
  font-weight: 700;
}

.form {
  display: flex;
  flex-direction: column;
  gap: var(--space);
}

.field__label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.field__input {
  width: 100%;
  min-height: 48px;
  padding: 0.625rem 0.875rem;
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--input-border);
  border-radius: var(--input-radius);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field__input::placeholder {
  color: #9ca3af;
}

.field__input:focus {
  outline: none;
  border-color: var(--info-border);
  box-shadow: 0 0 0 3px rgba(59, 130, 196, 0.2);
}

.field__input--readonly {
  background: var(--readonly-bg);
  color: var(--muted);
  cursor: default;
}

.field__input--readonly:focus {
  border-color: var(--input-border);
  box-shadow: none;
}

.field__input.is-invalid {
  border-color: #dc2626;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 1rem;
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: var(--input-radius);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}

.btn:active:not(:disabled) {
  transform: scale(0.99);
}

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

.btn--contract {
  background: var(--contract-green);
  color: #fff;
  gap: 0.625rem;
}

.btn--contract:hover:not(:disabled) {
  background: var(--contract-green-hover);
}

.btn--contract.is-read {
  background: #ecfdf5;
  border: 1.5px solid var(--contract-green);
  color: #166534;
  box-shadow: none;
}

.btn--contract.is-read:hover:not(:disabled) {
  background: #d1fae5;
  border-color: var(--contract-green-hover);
}

.btn--contract.is-read .btn__icon--contract {
  font-size: 1rem;
}

.btn__contract-text {
  line-height: 1.3;
}

.btn__read-main {
  font-weight: 700;
}

.btn__read-sub {
  font-weight: 400;
  opacity: 0.75;
}

.btn--submit {
  background: var(--submit-red);
  color: #fff;
  font-size: 1rem;
}

.btn--submit:hover:not(:disabled) {
  background: var(--submit-red-hover);
}

.btn__icon {
  font-size: 1.1rem;
}

.signature {
  position: relative;
  border: 2px dashed #c5cdd8;
  border-radius: var(--input-radius);
  background: #fff;
  overflow: hidden;
}

.signature__canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  touch-action: none;
  cursor: crosshair;
}

.signature__clear {
  position: absolute;
  left: 0.5rem;
  bottom: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #c8102e;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #fecaca;
  border-radius: 8px;
  cursor: pointer;
}

.signature__clear:hover {
  background: #fff5f5;
}

.form-message {
  padding: 0.75rem 0.875rem;
  border-radius: var(--input-radius);
  font-size: 0.875rem;
  font-weight: 500;
}

.form-message--error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.form-message--success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.form-message--info {
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  color: var(--info-text);
}

.field__hint {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

/* Başarı ekranı */
.success-screen {
  padding: clamp(1.5rem, 5vw, 2.5rem) var(--space);
  text-align: center;
}

.success-screen__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4.5rem;
  height: 4.5rem;
  margin: 0 auto 1.25rem;
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  background: var(--contract-green);
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(45, 143, 78, 0.35);
}

.success-screen__title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.25rem, 4vw, 1.5rem);
  font-weight: 700;
  color: var(--text);
}

.success-screen__text {
  margin: 0 0 1.5rem;
  font-size: 0.9375rem;
  color: var(--muted);
  line-height: 1.5;
}

.btn--whatsapp {
  margin-top: 0.5rem;
  background: #25d366;
  color: #fff;
  text-decoration: none;
  font-size: 1.0625rem;
  min-height: 56px;
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.35);
}

.btn--whatsapp:hover {
  background: #1ebe57;
  color: #fff;
}

.btn--whatsapp:active {
  background: #1aa952;
}

.btn__wa-icon {
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.modal {
  display: flex;
  flex-direction: column;
  width: min(100%, 520px);
  max-height: min(90dvh, 640px);
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(180deg, var(--header-from), var(--header-to));
  color: #fff;
}

.modal__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.modal__close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.modal__close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.modal__body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  font-size: 0.875rem;
  line-height: 1.6;
  color: #374151;
}

.modal__body h2,
.modal__body h3 {
  color: var(--text);
  font-size: 0.95rem;
  margin: 1.25rem 0 0.5rem;
}

.modal__body h2:first-child,
.modal__body h3:first-child {
  margin-top: 0;
}

.modal__body p,
.modal__body li {
  margin: 0 0 0.75rem;
}

.modal__body ul {
  padding-left: 1.25rem;
}

.modal__footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid #e5e7eb;
}

.modal__footer .btn--contract {
  margin: 0;
}
