/* QR platba — bulletproof CSS for iOS Safari 14+ */

:root {
  --bg: #F1F5F9;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --surface-3: #EFF3F9;
  --ink: #0F172A;
  --ink-2: #475569;
  --ink-3: #94A3B8;
  --border: #E2E8F0;
  --border-2: #CBD5E1;
  --primary: #0F172A;
  --primary-hover: #1E293B;
  --accent: #3B82F6;
  --accent-soft: #EFF6FF;
  --success: #10B981;
  --success-soft: #ECFDF5;
  --danger: #EF4444;
  --warning: #F59E0B;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(800px 400px at 90% -5%, rgba(59, 130, 246, 0.06), transparent 60%),
    radial-gradient(700px 400px at -5% 100%, rgba(16, 185, 129, 0.05), transparent 60%);
  background-attachment: fixed;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-user-select: none;
  user-select: none;
}

input, textarea, select {
  -webkit-user-select: text;
  user-select: text;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

h1, h2, h3, h4 {
  font-family: 'Varela Round', sans-serif;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ── App container ── */
.app {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

/* ── Hero ── */
.hero {
  text-align: center;
  margin-bottom: 28px;
}

.logo-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px auto;
  border-radius: 16px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.15);
}

.logo-mark i {
  width: 28px;
  height: 28px;
}

.hero h1 {
  font-size: 30px;
  margin-bottom: 8px;
}

.tagline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-2);
  background: var(--surface);
  padding: 6px 14px 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.tagline i {
  width: 14px;
  height: 14px;
  color: var(--success);
  flex-shrink: 0;
}

/* ── Layout grid ── */
.grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
  align-items: stretch;
}

@media (max-width: 880px) {
  .grid {
    display: block;
  }
}

/* ── QR side ── */
.qr-side {
  position: relative;
}

@media (min-width: 881px) {
  .qr-side {
    display: flex;
    height: 100%;
  }
  .qr-side .qr-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
  }
  .qr-controls {
    margin-top: auto;
  }
}

@media (max-width: 880px) {
  .qr-side {
    margin-bottom: 16px;
  }
}

.qr-stage {
  background: var(--surface);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  border: 1px solid var(--border);
  position: relative;
}

/* aspect ratio fallback using padding hack */
.qr-frame-outer {
  width: 100%;
  position: relative;
  padding-bottom: 100%;
  background: var(--surface-2);
  border-radius: 14px;
  overflow: hidden;
}

.qr-frame-inner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.qr-frame-inner.has-qr {
  padding: 12px;
  background: #fff;
}

.qr-frame-inner svg,
.qr-frame-inner img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}

.qr-placeholder {
  text-align: center;
  color: var(--ink-3);
}

.qr-placeholder i {
  width: 48px;
  height: 48px;
  opacity: 0.35;
  margin-bottom: 10px;
}

.qr-placeholder p {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

.qr-meta {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 22px;
}

.qr-format {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.qr-format .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-3);
}

.qr-format.ok { color: var(--success); }
.qr-format.ok .dot { background: var(--success); }
.qr-format.err { color: var(--danger); }
.qr-format.err .dot { background: var(--danger); }

.qr-amount {
  font-family: 'Varela Round', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.qr-amount:empty {
  display: none;
}

.qr-controls {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 48px 48px;
  gap: 8px;
}

.dl-primary {
  height: 48px;
  background: var(--primary);
  color: #fff;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  -webkit-appearance: none;
  appearance: none;
}

.dl-primary i {
  width: 16px;
  height: 16px;
}

.dl-primary:disabled {
  background: var(--surface-3);
  color: var(--ink-3);
  cursor: not-allowed;
}

.dl-icon {
  height: 48px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
  appearance: none;
}

.dl-icon i {
  width: 16px;
  height: 16px;
}

.dl-icon:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Toast ── */
.qr-toast {
  position: absolute;
  left: 50%;
  bottom: -40px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
}

.qr-toast.show {
  opacity: 1;
}


/* ── QR tip ── */
.qr-tip {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.qr-tip > i {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 1px;
}

.qr-tip strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 3px;
  letter-spacing: -0.005em;
}

.qr-tip span {
  font-size: 11px;
  color: var(--ink-2);
  line-height: 1.45;
}


/* ── Form side ── */
.form-side {
  display: block;
}

.card {
  background: var(--surface);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.04);
  border: 1px solid var(--border);
}

.field {
  margin-bottom: 16px;
}

.field:last-child {
  margin-bottom: 0;
}

.lbl-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  min-height: 18px;
}

.lbl-row label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.opt {
  font-weight: 400;
  font-size: 12px;
  color: var(--ink-3);
}

.counter {
  font-weight: 500;
  font-size: 11px;
  color: var(--ink-3);
}

.counter.warn { color: var(--warning); }
.counter.danger { color: var(--danger); }

.bank-tag {
  display: none;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 9px;
  border-radius: 999px;
}

.bank-tag.show {
  display: inline-block;
}

input[type="text"],
input[type="number"],
input[type="date"],
select {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1.5px solid var(--surface-2);
  border-radius: 12px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  display: block;
}

input[type="date"] {
  line-height: 46px;
  text-align: left;
  min-height: 46px;
}

input.mono {
  font-family: 'JetBrains Mono', 'SF Mono', 'Menlo', monospace;
  font-weight: 500;
  letter-spacing: 0.02em;
}

input:focus,
select:focus {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

input::placeholder {
  color: var(--ink-3);
  opacity: 0.8;
}

/* ── IBAN field with icons ── */
.input-wrap {
  position: relative;
}

.input-wrap input {
  padding-right: 44px;
}

.input-icon {
  position: absolute;
  right: 14px;
  top: 13px;
  width: 20px;
  height: 20px;
  pointer-events: none;
  display: none;
}

.input-icon.ok { color: var(--success); }
.input-icon.err { color: var(--danger); }

.input-icon.show {
  display: block;
}

/* ── Message under input ── */
.msg {
  font-size: 12px;
  margin-top: 6px;
  min-height: 16px;
  color: var(--ink-3);
  line-height: 1.4;
}

.msg.ok { color: var(--success); }
.msg.err { color: var(--danger); }

/* ── Amount row ── */
.amt-row {
  display: flex;
  gap: 8px;
}

.amt-row .amt-input {
  flex: 1 1 auto;
  font-size: 18px;
  font-weight: 600;
  min-width: 0;
}

.amt-cur {
  flex: 0 0 90px;
  width: 90px;
  background: var(--surface-2);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px;
  padding-right: 26px;
  padding-left: 12px;
}

/* ── Pair row ── */
.row-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.row-pair .field {
  margin-bottom: 0;
}

/* ── More toggle ── */
.more-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 40px;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface-2);
  border-radius: 10px;
  -webkit-appearance: none;
  appearance: none;
}

.more-toggle .more-chev {
  width: 14px;
  height: 14px;
  transition: -webkit-transform 0.2s ease, transform 0.2s ease;
}

.more-toggle[aria-expanded="true"] .more-chev {
  -webkit-transform: rotate(180deg);
  transform: rotate(180deg);
}

.more {
  display: none;
  margin-top: 16px;
}

.more.show {
  display: block;
}

#row-bic {
  display: none;
}

#row-bic.show {
  display: block;
}

/* ── Footer note ── */
.footer-note {
  margin-top: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.5;
  border: 1px dashed var(--border-2);
  border-radius: 10px;
}

.footer-note i {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ── Mobile ── */
@media (max-width: 880px) {
  .app { padding: 20px 16px 48px; }
  .hero { margin-bottom: 18px; }
  .hero h1 { font-size: 26px; }
  .logo-mark { width: 48px; height: 48px; margin-bottom: 12px; }
  .logo-mark i { width: 24px; height: 24px; }
  .qr-stage { padding: 16px; border-radius: 18px; }
  .card { padding: 18px; border-radius: 16px; }
}
