/*
 * Kassan med betalning direkt på StuderaHP (inc/checkout-elements.php).
 * Bygger på tokens.css. Betalfälten och wallet-knapparna är Stripes iframes
 * och stylas via Appearance API i javascript/checkout-elements.js, inte här.
 * Pro-violetten och gradientramen är samma som i upsell.css (.shpu).
 */

.cce {
  --cce-ink: var(--ink, #0f172a);
  --cce-ink-2: #475569;
  --cce-ink-3: #64748b;
  --cce-blue: var(--blue-600, #2563eb);
  --cce-blue-strong: var(--blue-700, #1d4ed8);
  --cce-blue-soft: var(--blue-50, #eff6ff);
  --cce-violet: #7548cd;
  --cce-violet-deep: #5b34b8;
  --cce-violet-soft: #f1ebff;
  --cce-violet-line: #e2d6fd;
  --cce-border: var(--border, #e2e8f0);
  --cce-border-strong: var(--border-strong, #cbd5e1);
  --cce-surface-soft: #f8fafd;
  --cce-ok: #15803d;
  --cce-danger: #b91c1c;
  --cce-focus: 0 0 0 3px rgba(37, 99, 235, 0.3);
  --cce-frame-a: #b9cdfc;
  color: var(--cce-ink);
  font-family: var(--font-ui, "Inter", system-ui, sans-serif);
  -webkit-font-smoothing: antialiased;
  min-height: 60vh;
}
.cce[data-plan="proai"] { --cce-frame-a: #cdb8ff; }
.cce *, .cce *::before, .cce *::after { box-sizing: border-box; }

#main-container:has(.cce) {
  background: linear-gradient(180deg, #eef4ff 0, var(--bg, #f8fafc) 420px) !important;
}

.cce { padding: 36px 0 64px; }
.cce-container { max-width: 1000px; margin: 0 auto; padding: 0 24px; }

.cce-steps { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; font-size: 13px; font-weight: 600; color: var(--cce-ink-3); }
.cce-steps__item { display: inline-flex; align-items: center; gap: 5px; }
.cce-steps__item--done { color: var(--cce-ok); }
.cce-steps__item--current { color: var(--cce-ink); }
.cce-steps__divider { width: 24px; height: 1px; background: var(--cce-border-strong); }

.cce-title { margin: 0 0 24px; font-size: clamp(25px, 3vw, 36px); font-weight: 800; line-height: 1.1; letter-spacing: -0.025em; color: var(--cce-ink); }
.cce-title::after { content: none; }

.cce-banner {
  display: flex; align-items: flex-start; gap: 12px; margin: 0 0 20px; padding: 14px 18px;
  border: 1px solid #fca5a5; border-left-width: 1px; border-radius: 12px; background: #fef2f2;
  color: #7f1d1d; font-size: 14.5px; line-height: 1.55;
}
.cce-banner__icon { flex: 0 0 auto; margin-top: 2px; color: #dc2626; }
.cce-banner__title { display: block; font-weight: 700; color: #991b1b; }
.cce-banner__text { display: block; color: #7f1d1d; }

.cce-shell { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.cce-pay { order: 1; }
.cce-order { order: 2; }

/* ---------- Ordersammanfattning ---------- */

.cce-order {
  position: sticky;
  top: 24px;
  padding: 24px;
  border-radius: 24px;
  border: 1px solid transparent;
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(160deg, var(--cce-frame-a) 0%, #dbe6ff 42%, #e6ebf3 100%) border-box;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.05), 0 40px 80px -32px rgba(37, 52, 120, 0.34);
}
.cce-order__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.cce-order__headtext { min-width: 0; padding-top: 2px; }
.cce-order__kicker { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--cce-ink-3); letter-spacing: 0; text-transform: none; }
.cce-order__title { margin: 0; font-size: 28px; font-weight: 800; line-height: 1.1; letter-spacing: -0.035em; }
.cce-order__plan { color: var(--cce-blue); transition: color .2s ease; }
.cce[data-plan="proai"] .cce-order__plan { color: var(--cce-violet); }
.cce-order__meta { margin: 8px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--cce-ink-2); }
.cce-order__mascot { flex: 0 0 auto; width: 74px; height: auto; margin: -8px -6px 0 0; }

.cce-features { list-style: none; margin: 18px 0 0; padding: 0; border: 1px solid #e3e9f3; border-radius: 16px; background: var(--cce-surface-soft); overflow: hidden; }
.cce-feature { display: flex; align-items: center; gap: 12px; margin: 0; padding: 10px 12px; font-size: 14px; font-weight: 600; line-height: 1.4; }
.cce-feature + .cce-feature { border-top: 1px solid #edf1f7; }
.cce-feature::before, .cce-feature::marker { content: none; }
.cce-feature__icon { flex: 0 0 auto; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; }
.cce-feature__icon--blue { background: #eef4ff; color: var(--cce-blue); }
.cce-feature__icon--green { background: #f0fdf4; color: #16a34a; }
.cce-feature__icon--violet { background: var(--cce-violet-soft); color: var(--cce-violet); }
.cce[data-plan="proai"] .cce-feature__ai { color: var(--cce-violet); }

.cce-addon {
  margin-top: 12px; display: flex; align-items: flex-start; gap: 12px; padding: 14px;
  border-radius: 14px; border: 1px solid var(--cce-violet-line); background: #faf7ff; cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.cce-addon:hover { border-color: #c9b6f5; }
.cce-addon:has(input:checked) { border: 1.5px solid var(--cce-violet); background: var(--cce-violet-soft); box-shadow: 0 0 0 3px rgba(117, 72, 205, 0.12); }
.cce-addon:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(117, 72, 205, 0.35); }
.cce-addon input { flex: 0 0 auto; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--cce-violet); cursor: pointer; }
.cce-addon__body { flex: 1 1 auto; min-width: 0; }
.cce-addon__row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.cce-addon__title { font-size: 15px; font-weight: 700; color: var(--cce-ink); }
.cce-addon__price { font-size: 15px; font-weight: 700; color: var(--cce-violet-deep); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cce-addon__text { display: block; margin-top: 4px; font-size: 13.5px; line-height: 1.5; color: var(--cce-ink-2); }
.cce-addon__text strong { color: var(--cce-violet-deep); }
.cce-addon[aria-busy="true"] { opacity: .7; cursor: progress; }

.cce-upgrade-note { margin: 12px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--cce-violet-soft); border: 1px solid var(--cce-violet-line); font-size: 13.5px; line-height: 1.5; color: #3b2a6b; }

.cce-lines { margin: 16px 0 0; display: grid; gap: 8px; }
.cce-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.cce-line dt { margin: 0; font-size: 14px; color: var(--cce-ink-2); }
.cce-line dd { margin: 0; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cce-line--discount dd { color: var(--cce-ok); }
.cce-line[hidden] { display: none; }

.cce-total { margin-top: 14px; padding: 14px 16px; border-radius: 16px; background: var(--cce-blue-soft); border: 1px solid #dbe6ff; }
.cce-total__row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.cce-total__label { font-size: 15px; font-weight: 700; color: #1e3a8a; }
.cce-total__amount { font-size: 32px; font-weight: 800; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.cce-total__amount s { margin-right: 8px; font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--cce-ink-3); }
.cce-total__vat { margin: 2px 0 0; text-align: right; font-size: 12.5px; color: var(--cce-ink-2); font-variant-numeric: tabular-nums; }

.cce-discount { margin-top: 12px; }
.cce-discount__applied {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px;
  padding: 4px 4px 4px 12px; border-radius: 10px; background: #f0fdf4; border: 1px solid #bbf7d0; color: #14532d; font-size: 14px;
}
.cce-discount__applied[hidden], .cce-discount__fields[hidden], .cce-discount__toggle[hidden] { display: none; }
.cce-discount__row { display: flex; gap: 8px; padding-bottom: 4px; }
.cce-linkbtn {
  min-height: 44px; padding: 0; border: 0; background: none; font: inherit; font-size: 14px; font-weight: 600;
  color: var(--cce-ink-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.cce-linkbtn:hover { color: var(--cce-blue); }
.cce-discount__applied .cce-linkbtn { min-height: 36px; padding: 0 10px; border-radius: 8px; font-size: 13px; color: #166534; }
.cce-support { margin: 14px 0 0; font-size: 13px; color: var(--cce-ink-2); }
.cce-support a { color: var(--cce-blue); font-weight: 600; }

.cce-skeleton {
  display: inline-block; width: 64px; height: 16px; border-radius: 6px; vertical-align: middle;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%); background-size: 200% 100%;
  animation: cce-shimmer 1.4s ease infinite;
}
.cce-skeleton--lg { width: 110px; height: 28px; }
@keyframes cce-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Betalning ---------- */

.cce-pay {
  min-width: 0; padding: 28px; border-radius: 16px; border: 1px solid var(--cce-border); background: #fff;
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.06));
}
.cce-pay__title { margin: 0 0 16px; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }

.cce-note { margin: 0 0 14px; font-size: 14px; line-height: 1.55; color: var(--cce-ink-2); }
.cce-note a { color: var(--cce-blue); font-weight: 600; }

.cce-field__label { display: block; margin: 0 0 6px; font-size: 14.5px; font-weight: 600; }
.cce-field__help { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: var(--cce-ink-2); }
.cce-input {
  width: 100%; min-height: 52px; padding: 12px 14px; border: 1px solid var(--cce-border-strong); border-radius: 10px;
  font: inherit; font-size: 16px; color: var(--cce-ink); background: #fff;
}
.cce-input--sm { min-height: 44px; padding: 8px 12px; font-size: 15px; text-transform: uppercase; flex: 1 1 auto; min-width: 0; }
.cce-input:focus { outline: none; border-color: var(--cce-blue); box-shadow: var(--cce-focus); }
.cce-input.is-invalid { border-color: #dc2626; }
.cce-input.is-checked { border-color: #86efac; }
.cce-msg { min-height: 0; margin: 6px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--cce-ink-2); }
.cce-msg:empty { display: none; }
.cce-msg.is-error { color: var(--cce-danger); font-weight: 600; }
.cce-msg.is-ok { color: var(--cce-ok); }

.cce-account {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px;
  background: #f8fafc; border: 1px solid var(--cce-border); border-radius: 10px;
}
.cce-account__text { min-width: 0; display: flex; flex-direction: column; }
.cce-account__label { font-size: 13px; color: var(--cce-ink-2); }
.cce-account__email { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.cce-account__switch { flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; font-weight: 600; color: var(--cce-blue); }

.cce-login-required { margin-top: 12px; padding: 16px; border-radius: 12px; background: var(--cce-blue-soft); border: 1px solid #bfdbfe; }
.cce-login-required[hidden] { display: none; }
.cce-login-required__title { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.4; }
.cce-login-required__text { margin: 6px 0 14px; font-size: 14px; line-height: 1.55; color: #334155; }
.cce-login-required__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.cce-textlink {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: none;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--cce-blue-strong); text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.cce-textlink--muted { color: var(--cce-ink-2); }
.cce-textlink[hidden] { display: none; }

.cce-terms { margin: 0 0 16px; font-size: 13.5px; line-height: 1.55; color: var(--cce-ink-2); }
.cce-terms a { color: var(--cce-blue); font-weight: 600; }

.cce-payment { margin-top: 22px; }
.cce-payment.is-blocked { opacity: .4; pointer-events: none; }

.cce-express__slot { min-height: 48px; }
.cce[data-express="none"] .cce-express { display: none; }
.cce[data-express="pending"] .cce-express__slot {
  border-radius: 8px; background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%); background-size: 200% 100%;
  animation: cce-shimmer 1.4s ease infinite;
}
.cce-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 14px; font-size: 13px; font-weight: 500; color: var(--cce-ink-3); }
.cce-divider::before, .cce-divider::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--cce-border); }
.cce-payment__label { display: none; margin: 0 0 10px; font-size: 14.5px; font-weight: 600; }
.cce[data-express="none"] .cce-payment__label { display: block; }

.cce-element-skeleton { display: grid; gap: 12px; }
.cce-element-skeleton[hidden], .cce-loading[hidden] { display: none; }
.cce-element-skeleton__tabs, .cce-element-skeleton__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cce-element-skeleton__tabs span { height: 64px; border-radius: 10px; background: #eef2f7; }
.cce-element-skeleton__label { width: 96px; height: 12px; margin-top: 6px; border-radius: 6px; background: #e2e8f0; }
.cce-element-skeleton__field { display: block; height: 52px; border-radius: 10px; background: #eef2f7; }
.cce-loading { margin: 12px 0 0; font-size: 13px; color: var(--cce-ink-3); }

.cce-klarna { margin-top: 16px; display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 12px; background: #f8fafc; border: 1px solid var(--cce-border); }
.cce-klarna[hidden] { display: none; }
.cce-klarna__icon { flex: 0 0 auto; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: #fff; border: 1px solid var(--cce-border); color: #334155; }
.cce-klarna__title { margin: 0; font-size: 15px; font-weight: 700; }
.cce-klarna__text { margin: 6px 0 0; font-size: 14px; line-height: 1.55; color: var(--cce-ink-2); }

.cce-error { margin-top: 16px; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; font-size: 14px; line-height: 1.5; }
.cce-error[hidden] { display: none; }
.cce-error svg { flex: 0 0 auto; margin-top: 2px; }
.cce-error__title { display: block; color: #7f1d1d; }
.cce-error__title:empty { display: none; }

.cce-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid transparent; border-radius: 10px;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; transition: background .15s ease, box-shadow .15s ease;
}
.cce-btn:focus-visible, .cce-linkbtn:focus-visible, .cce-textlink:focus-visible, .cce a:focus-visible { outline: none; box-shadow: var(--cce-focus); border-radius: 8px; }
.cce-btn--primary { background: var(--cce-blue); color: #fff; }
.cce-btn--primary:hover { background: var(--cce-blue-strong); color: #fff; }
.cce-btn--md { min-height: 44px; padding: 0 20px; font-size: 15px; }
.cce-btn--outline { min-height: 44px; padding: 0 14px; border-color: var(--cce-blue); background: #fff; color: var(--cce-blue-strong); font-size: 14px; }
.cce-btn--outline:hover { background: var(--cce-blue-soft); }
.cce-btn--outline[disabled] { opacity: .55; cursor: not-allowed; }
.cce-btn--pay { margin-top: 20px; width: 100%; min-height: 56px; border-radius: 12px; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cce-btn--pay[disabled] { background: #e2e8f0; color: var(--cce-ink-3); cursor: not-allowed; }
.cce-btn--pay[aria-busy="true"] { background: var(--cce-blue); color: #fff; cursor: wait; }
.cce-spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; animation: cce-spin .7s linear infinite; }
.cce-spinner[hidden] { display: none; }
@keyframes cce-spin { to { transform: rotate(360deg); } }
.cce-processing { margin: 10px 0 0; text-align: center; font-size: 13.5px; line-height: 1.5; color: #334155; }
.cce-processing[hidden] { display: none; }

.cce-paynote { margin: 12px 0 0; text-align: center; font-size: 13.5px; line-height: 1.5; color: var(--cce-ink-2); }
.cce-secure { margin: 6px 0 0; display: flex; justify-content: center; align-items: flex-start; gap: 6px; text-align: center; font-size: 13px; line-height: 1.5; color: var(--cce-ink-3); }
.cce-secure svg { flex: 0 0 auto; margin-top: 3px; }

.cce .screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }

/* ---------- Mobil: kort sammanfattning överst, betalningen direkt under ---------- */

@media (max-width: 860px) {
  .cce { padding-top: 18px; }
  .cce-container { padding: 0 16px; }
  .cce-steps { display: none; }
  .cce-title { margin-bottom: 14px; font-size: 25px; }
  .cce-shell { grid-template-columns: 1fr; gap: 14px; }
  .cce-order { order: 1; position: static; padding: 16px 16px 6px; border-radius: 20px; }
  .cce-pay { order: 2; padding: 20px; }
  .cce-order__title { font-size: 20px; }
  .cce-order__mascot { width: 52px; margin: -4px -2px 0 0; }
  .cce-features, .cce-lines, .cce-support { display: none; }
  .cce-total { margin-top: 12px; padding: 10px 14px; }
  .cce-total__amount { font-size: 24px; }
  .cce-addon { padding: 12px; }
  .cce-addon__text { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .cce *, .cce *::before, .cce *::after { transition: none !important; animation: none !important; }
}
