/* Lavin customer portal + login (/lms/*). Loaded via page_css on top of
   styles.css / shared-header.css. Mobile first: no fixed widths, the purchase
   table becomes stacked cards under 640px. Class prefix lp-. */

.lp {
  --lp-surface: var(--vit, #fff);
  --lp-line: rgba(0, 19, 23, 0.1);
  --lp-muted: var(--moln, #557F8B);
  --lp-radius: var(--radius-card, 16px);
  --lp-pill: var(--radius-pill, 100px);
  box-sizing: border-box;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: calc(var(--header-h, 120px) + 1.25rem) 1rem 4rem;
  min-height: 70vh;
  font-size: 1rem;
}

.lp--narrow { max-width: 720px; }

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

.lp a:not(.lp-btn):not(.lp-tile) { color: inherit; }

/* --- Type --- */
.lp-title {
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  margin-bottom: 0.25rem;
}
.lp-subtitle { font-size: 1.25rem; margin: 0 0 1rem; }
.lp-muted { color: var(--lp-muted); }
.lp-small { font-size: 0.875rem; }
.lp-meta { font-size: 0.875rem; color: var(--lp-muted); }
.lp-meta__label { font-weight: 600; color: var(--black, #001317); margin-right: 0.25rem; }
.lp-link { text-decoration: underline; text-underline-offset: 2px; font-weight: 500; }
.lp-link:hover { color: var(--eld, #FA5508); }
.lp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lp p + p { margin-top: 0.5rem; }

.lp-head { margin: 1.25rem 0 1.25rem; }
.lp-section { margin-bottom: 1.5rem; }

/* --- Tabs --- */
.lp-tabs {
  display: flex;
  gap: 0.375rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.lp-tabs::-webkit-scrollbar { display: none; }
.lp-tabs a {
  flex: 0 0 auto;
  padding: 0.4rem 0.9rem;
  border-radius: var(--lp-pill);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--lp-muted);
  background: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  white-space: nowrap;
}
.lp-tabs a:hover { color: var(--black, #001317); }
.lp-tabs a.is-active { background: var(--black, #001317); color: var(--dimma, #FAF4E5); }

/* --- Cards --- */
.lp-card {
  background: var(--lp-surface);
  border-radius: var(--lp-radius);
  box-shadow: 0 1px 3px rgba(0, 19, 23, 0.06);
  overflow: hidden;
}
.lp-card--pad { padding: 1.25rem; }
.lp-card + .lp-card { margin-top: 1rem; }
.lp-empty { text-align: center; }
.lp-empty > * + * { margin-top: 1rem; }

/* --- Buttons --- */
.lp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  min-height: 44px;
  padding: 0.625rem 1.25rem;
  border-radius: var(--lp-pill);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.lp-btn--sm { min-height: 36px; padding: 0.4rem 0.95rem; font-size: 0.875rem; }
.lp-btn--block { width: 100%; }
.lp-btn--primary { background: var(--eld, #FA5508); color: #fff; }
.lp-btn--primary:hover { background: #e04a00; }
.lp-btn--dark { background: var(--black, #001317); color: var(--dimma, #FAF4E5); }
.lp-btn--dark:hover { background: var(--moln, #557F8B); }
.lp-btn--ghost { background: transparent; border-color: rgba(0, 19, 23, 0.2); color: var(--black, #001317); }
.lp-btn--ghost:hover { border-color: var(--black, #001317); }
.lp-btn:focus-visible, .lp-tabs a:focus-visible, .lp-session__head:focus-visible {
  outline: 2px solid var(--eld, #FA5508);
  outline-offset: 2px;
}

.lp-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 0.75rem;
}
.lp-actions:empty { display: none; }

/* --- Badges --- */
.lp-badge {
  display: inline-block;
  padding: 0.125rem 0.6rem;
  border-radius: var(--lp-pill);
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(85, 127, 139, 0.15);
  color: var(--moln, #557F8B);
  vertical-align: middle;
}
.lp-badge--ok { background: var(--dagg, #E1E7C3); color: #3d4a12; }
.lp-badge--warn { background: #fef3c7; color: #92400e; }
.lp-badge--danger { background: #fee2e2; color: #991b1b; }
.lp-badge--today { background: var(--eld, #FA5508); color: #fff; }

/* --- Alerts --- */
.lp-alert {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.9375rem;
  line-height: 1.5;
  margin: 0 0 1rem;
}
.lp-alert--ok { background: var(--dagg, #E1E7C3); }
.lp-alert--error { background: #fee2e2; color: #991b1b; }

/* --- Forms --- */
.lp-form > * + * { margin-top: 1rem; }
.lp-field label, .lp-field > span { display: block; font-size: 0.875rem; font-weight: 600; margin-bottom: 0.375rem; }
.lp-field input:not([type=checkbox]):not([type=file]), .lp-field textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid rgba(0, 19, 23, 0.18);
  border-radius: 10px;
  font: inherit;
  font-size: 1rem; /* 16px: no zoom-on-focus on iOS */
  background: #fff;
  color: var(--black, #001317);
}
.lp-field textarea { resize: vertical; min-height: 6rem; }
.lp-field input:focus, .lp-field textarea:focus { outline: none; border-color: var(--moln, #557F8B); box-shadow: 0 0 0 3px rgba(85, 127, 139, 0.18); }
.lp-field input:disabled { background: #f5f2ec; color: var(--lp-muted); }
.lp-field .lp-small { margin-top: 0.375rem; }
.lp-field--file input { font-size: 0.875rem; max-width: 100%; }
.lp-check { display: flex; gap: 0.75rem; align-items: flex-start; cursor: pointer; font-size: 0.9375rem; }
.lp-check input { width: 1.125rem; height: 1.125rem; margin-top: 0.2rem; flex: 0 0 auto; accent-color: var(--eld, #FA5508); }

/* --- Login --- */
.lp-login { max-width: 960px; }
.lp-login__grid { display: grid; gap: 1.5rem; align-items: center; padding-top: 1rem; }
.lp-login__card .lp-muted { margin-bottom: 1.25rem; }
.lp-login__toggle { text-align: center; margin-top: 1.25rem; font-size: 0.875rem; }
.lp-login__toggle a { color: var(--lp-muted); text-decoration: underline; }
.lp-login__info h2 { font-size: 1.375rem; margin-bottom: 0.5rem; }
.lp-login__info a { text-decoration: underline; }
.lp-login__info .lp-small { margin-top: 0.75rem; color: var(--lp-muted); }

/* --- Courses --- */
.lp-course__top { display: flex; flex-direction: column; }
.lp-course__img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--dimma, #FAF4E5); }
.lp-course__info { padding: 1.25rem; min-width: 0; }
.lp-course__title { font-size: 1.375rem; margin: 0.5rem 0 0.25rem; }
.lp-course + .lp-course { margin-top: 1.25rem; }

.lp-timeline { border-top: 1px solid var(--lp-line); }
.lp-timeline__head {
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--lp-muted);
  padding: 1rem 1.25rem 0.25rem;
}

.lp-session { border-bottom: 1px solid var(--lp-line); }
.lp-session:last-child { border-bottom: 0; }
.lp-session__head {
  list-style: none;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "dot title chev" ". date date";
  column-gap: 0.75rem;
  row-gap: 0.125rem;
  align-items: center;
  padding: 0.875rem 1.25rem;
  cursor: pointer;
}
.lp-session__head::-webkit-details-marker { display: none; }
.lp-session__head::after {
  grid-area: chev;
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-right: 1.5px solid var(--lp-muted);
  border-bottom: 1.5px solid var(--lp-muted);
  transform: rotate(45deg);
  transition: transform 0.15s;
  margin: 0 0.25rem 0.25rem;
}
.lp-session[open] > .lp-session__head::after { transform: rotate(-135deg); margin-bottom: -0.1rem; }
.lp-session__dot { grid-area: dot; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: rgba(0, 19, 23, 0.18); }
.lp-session--past .lp-session__dot { background: var(--moln, #557F8B); }
.lp-session--today .lp-session__dot { background: var(--eld, #FA5508); box-shadow: 0 0 0 4px rgba(250, 85, 8, 0.18); }
.lp-session__title { grid-area: title; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.lp-session__date { grid-area: date; font-size: 0.8125rem; color: var(--lp-muted); }
.lp-session__body { padding: 0 1.25rem 1.25rem 2.55rem; min-width: 0; }
.lp-session__body > .lp-actions:first-child { margin-top: 0; }

/* Material: admin-authored HTML, keep it readable and contained. */
.lp-material { font-size: 0.9375rem; line-height: 1.6; overflow-wrap: anywhere; margin-top: 0.5rem; }
.lp-material p, .lp-material ul, .lp-material ol { margin: 0 0 0.75rem; }
.lp-material ul, .lp-material ol { padding-left: 1.25rem; }
.lp-material a { color: var(--eld, #FA5508); text-decoration: underline; }
.lp-material img, .lp-material iframe, .lp-material video { max-width: 100%; height: auto; border-radius: var(--radius-media, 12px); }
.lp-material h1, .lp-material h2, .lp-material h3 { font-size: 1.125rem; margin: 1rem 0 0.5rem; }
.lp-material__head { font-family: inherit; font-size: 0.875rem; margin-top: 1rem; }

/* Tabs "Material före / efter" — radio buttons, no JS. */
.lp-mtabs { display: flex; flex-wrap: wrap; margin-top: 1rem; }
.lp-mtabs input { position: absolute; opacity: 0; pointer-events: none; }
.lp-mtabs label {
  padding: 0.4rem 0.8rem;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--lp-muted);
  border-bottom: 2px solid transparent;
}
.lp-mtabs input:checked + label { color: var(--eld, #FA5508); font-weight: 600; border-bottom-color: var(--eld, #FA5508); }
.lp-mtabs input:focus-visible + label { outline: 2px solid var(--eld, #FA5508); outline-offset: 2px; }
.lp-mtabs__panel { display: none; width: 100%; border-top: 1px solid var(--lp-line); padding-top: 0.75rem; margin-top: -1px; }
.lp-mtabs__pre:checked ~ .lp-mtabs__panel--pre,
.lp-mtabs__post:checked ~ .lp-mtabs__panel--post { display: block; }

/* Add to calendar */
.lp-cal { position: relative; font-size: 0.875rem; }
.lp-cal > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0.4rem 0.95rem;
  border-radius: var(--lp-pill);
  border: 1px solid rgba(0, 19, 23, 0.2);
  font-weight: 600;
}
.lp-cal > summary::-webkit-details-marker { display: none; }
.lp-cal__menu {
  margin-top: 0.375rem;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--lp-line);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 19, 23, 0.1);
  overflow: hidden;
}
.lp-cal__menu a { padding: 0.625rem 0.875rem; text-decoration: none; }
.lp-cal__menu a:hover { background: var(--page-bg, #EAE0D2); }

/* Suggestions */
.lp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 1rem; text-align: left; }
.lp-tile { display: flex; flex-direction: column; background: var(--page-bg, #EAE0D2); border-radius: 12px; overflow: hidden; text-decoration: none; color: inherit; }
.lp-tile img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.lp-tile__body { padding: 0.75rem; display: flex; flex-direction: column; gap: 0.25rem; }
.lp-tile__title { font-weight: 600; }

/* --- Webinars --- */
.lp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 1rem; }
.lp-cards .lp-card + .lp-card { margin-top: 0; }
.lp-webinar { display: flex; flex-direction: column; }
.lp-webinar.is-mine { box-shadow: 0 0 0 2px var(--dagg, #E1E7C3), 0 1px 3px rgba(0, 19, 23, 0.06); }
.lp-webinar__img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.lp-webinar__body { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.25rem; }
.lp-webinar__title { font-size: 1.1875rem; margin-top: 0.25rem; }
.lp-welcome { margin-top: 0.75rem; font-size: 0.875rem; }
.lp-welcome > summary { cursor: pointer; font-weight: 600; text-decoration: underline; }
.lp-welcome__frame { width: 100%; height: 22rem; border: 1px solid var(--lp-line); border-radius: 10px; margin-top: 0.5rem; background: #fff; }
.lp-rec { width: 100%; }
.lp-rec > summary { list-style: none; }
.lp-rec > summary::-webkit-details-marker { display: none; }
.lp-rec__frame { margin-top: 0.75rem; position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius-media, 12px); overflow: hidden; }
.lp-rec__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* --- Purchases: stacked cards on phones, a table from 640px --- */
.lp-table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.lp-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.lp-table tr { display: block; padding: 1rem 1.25rem; border-bottom: 1px solid var(--lp-line); }
.lp-table tr:last-child { border-bottom: 0; }
.lp-table td { display: flex; gap: 1rem; justify-content: space-between; padding: 0.2rem 0; text-align: right; }
.lp-table td::before { content: attr(data-label); font-size: 0.8125rem; font-weight: 600; color: var(--lp-muted); text-align: left; flex: 0 0 auto; }
.lp-table td[data-label="Produkt"] { flex-direction: column; text-align: left; gap: 0; }
.lp-table td[data-label="Produkt"]::before { display: none; }

/* --- Settings --- */
.lp-avatar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.lp-avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.lp-avatar--initials { display: inline-flex; align-items: center; justify-content: center; background: var(--dagg, #E1E7C3); font-weight: 700; font-size: 1.5rem; }
.lp-avatar-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.5rem 0.75rem; min-width: 0; flex: 1 1 14rem; }
.lp-avatar-form .lp-field { margin: 0; min-width: 0; flex: 1 1 12rem; }
.lp-avatar-form .lp-small { width: 100%; margin: 0; }

@media (min-width: 640px) {
  .lp { padding-left: 1.5rem; padding-right: 1.5rem; }
  .lp-card--pad { padding: 1.75rem; }

  .lp-table thead { position: static; width: auto; height: auto; clip: auto; overflow: visible; display: table-header-group; }
  .lp-table tr { display: table-row; padding: 0; }
  .lp-table th, .lp-table td { display: table-cell; padding: 0.875rem 1rem; text-align: left; border-bottom: 1px solid var(--lp-line); vertical-align: top; }
  .lp-table tbody tr:last-child td { border-bottom: 0; }
  .lp-table td::before { display: none; }
  .lp-table th { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--lp-muted); }
  .lp-table td[data-label="Kvitto"] { text-align: right; white-space: nowrap; }

  .lp-session__head { grid-template-columns: auto 1fr auto auto; grid-template-areas: "dot title date chev"; }
  .lp-session__date { white-space: nowrap; }
}

@media (min-width: 800px) {
  .lp-login__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4rem; padding-top: 3rem; }
  .lp-course__top { flex-direction: row; }
  .lp-course__img { width: 240px; aspect-ratio: 1; object-fit: cover; flex: 0 0 auto; }
  .lp-cal { position: relative; }
  .lp-cal__menu { position: absolute; top: 100%; left: 0; min-width: 190px; z-index: 20; }
}

/* The active tab must beat `.lp a:not(.lp-btn):not(.lp-tile)` (0,3,1), which
   otherwise paints its label the same colour as its background. */
.lp .lp-tabs a.is-active:not(.lp-btn) { color: var(--dimma, #FAF4E5); }
