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

:root {
  --bg:        #f4f5f7;
  --surface:   #ffffff;
  --border:    #e2e5eb;
  --accent:    #4361ee;
  --accent-h:  #3451d1;
  --success:   #22c55e;
  --error:     #ef4444;
  --warning:   #f59e0b;
  --text:      #1a1f36;
  --muted:     #6b7280;
  --radius:    14px;
  --shadow:    0 2px 16px rgba(0,0,0,.08);
}

html { font-size: 16px; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Layout ──────────────────────────────────────────────────────────────── */
.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
}

.header {
  padding: 24px 0 16px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}
.logo:hover { text-decoration: none; }
.logo-icon {
  font-size: 22px;
  color: var(--accent);
}

.main {
  flex: 1;
  padding: 8px 0 32px;
}

.footer {
  padding: 20px 0 28px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* ─── Card ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 8px;
}
.card-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 24px;
  line-height: 1.6;
}

/* ─── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 18px;
  line-height: 1.5;
}
.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}
.alert-error a { color: #991b1b; text-decoration: underline; }

/* ─── Form ────────────────────────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 16px; }

.form-group { display: flex; flex-direction: column; gap: 4px; }

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s;
  outline: none;
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(67,97,238,.12);
}
.form-input.input-error { border-color: var(--error); }

.form-hint {
  font-size: 12px;
  color: var(--muted);
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 11px 22px;
  border-radius: 9px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: background .15s, opacity .15s;
  text-align: center;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-h); text-decoration: none; }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: #e8eaf0; text-decoration: none; }

.btn-large { padding: 14px 22px; font-size: 16px; width: 100%; }

/* ─── Hint & links ────────────────────────────────────────────────────────── */
.hint {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
  text-align: center;
}

.back-link {
  display: inline-block;
  margin-top: 20px;
  font-size: 13px;
  color: var(--muted);
}
.back-link:hover { color: var(--accent); }

/* ─── Divider ─────────────────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 22px 0;
}

/* ─── Key info block ──────────────────────────────────────────────────────── */
.key-info { margin-bottom: 4px; }

.key-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 10px;
}
.key-badge--active  { background: #dcfce7; color: #166534; }
.key-badge--expired { background: #fee2e2; color: #991b1b; }
.key-badge--deleted { background: #f3f4f6; color: #6b7280; }

.key-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}
.key-date {
  font-size: 14px;
  color: var(--muted);
}
.key-date strong { color: var(--text); }

/* ─── Period selector ─────────────────────────────────────────────────────── */
.fieldset { border: none; }

.period-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 8px;
}

.period-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 10px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.period-card input[type=radio] { display: none; }

.period-card:hover { border-color: var(--accent); }

.period-card--selected {
  border-color: var(--accent);
  background: rgba(67,97,238,.05);
}

.period-months {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.period-price {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
}

/* ─── Pay note ────────────────────────────────────────────────────────────── */
.pay-note {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: -4px;
}

/* ─── Result page ─────────────────────────────────────────────────────────── */
.result-card {
  text-align: center;
  padding: 40px 28px;
}

.result-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 28px;
}
.result-icon--pending { background: #fef3c7; color: var(--warning); }
.result-icon--success { background: #dcfce7; color: var(--success); }
.result-icon--error   { background: #fee2e2; color: var(--error); }

.result-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 10px;
}
.result-text {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 20px;
}
.result-date {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 20px;
}

.check { font-size: 32px; }

/* ─── Spinner ─────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid rgba(245,158,11,.3);
  border-top-color: var(--warning);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .card { padding: 24px 18px; }
  .period-price { font-size: 16px; }
}
