/*
 * Lumora Core component styles.
 * Uses the Lumora theme's design tokens when present, with standalone fallbacks so plugin features remain usable
 * under any theme. Base primitives are wrapped in :where() (zero specificity) so themes override them easily.
 */

:root {
	--lmc-ink: var(--lm-ink, #173D4B);
	--lmc-soft: var(--lm-ink-soft, #4A6B7A);
	--lmc-primary: var(--lm-primary, #0677A0);
	--lmc-teal: var(--lm-teal, #086C79);
	--lmc-aqua: var(--lm-aqua, #35D7D0);
	--lmc-mint: var(--lm-mint-text, #0A7F6B);
	--lmc-warn: var(--lm-warn, #B45309);
	--lmc-danger: var(--lm-danger, #B42318);
	--lmc-line: var(--lm-line, rgba(8, 127, 165, .14));
	--lmc-surface: var(--lm-surface, #fff);
	--lmc-ice: var(--lm-ice, #EAF9FC);
	--lmc-radius: var(--lm-radius-md, 16px);
	--lmc-shadow: var(--lm-shadow-2, 0 12px 40px -12px rgba(8, 76, 98, .22));
	--lmc-ease: var(--lm-ease, cubic-bezier(.22, 1, .36, 1));
}

/* ---------- Base primitives (overridable) ---------- */
:where(.lm-btn) { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; padding: .7rem 1.35rem; border-radius: 999px; border: 1px solid transparent; font: 600 .9375rem/1.1 inherit; text-decoration: none; cursor: pointer; transition: transform .16s var(--lmc-ease), box-shadow .16s var(--lmc-ease), background-color .16s; }
:where(.lm-btn--primary) { background: var(--lmc-primary); color: #fff; }
:where(.lm-btn--glass) { background: rgba(255, 255, 255, .7); border-color: var(--lmc-line); color: var(--lmc-ink); }
:where(.lm-btn--ghost) { background: transparent; border-color: var(--lmc-line); color: var(--lmc-ink); }
:where(.lm-btn--sm) { min-height: 38px; padding: .5rem 1rem; font-size: .875rem; }
:where(.lm-input) { width: 100%; min-height: 46px; padding: .65rem .9rem; border: 1px solid rgba(8, 108, 121, .25); border-radius: 12px; background: #fff; color: var(--lmc-ink); font: inherit; }
:where(.lm-input):focus-visible { outline: 2px solid var(--lmc-primary); outline-offset: 2px; }
:where(.lm-eyebrow) { margin: 0 0 .35rem; font-size: .75rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--lmc-primary); }
.lm-muted { color: var(--lmc-soft); }
.lm-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; letter-spacing: .02em; overflow-wrap: anywhere; }
.lm-table .lm-mono, .lm-batch-list .lm-mono { white-space: nowrap; overflow-wrap: normal; }
.lm-num { font-variant-numeric: tabular-nums; }
.lm-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.lm-linklike { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.lm-error { color: var(--lmc-danger); }

/* ---------- Badges ---------- */
.lm-badge { display: inline-flex; align-items: center; gap: .35rem; padding: .28rem .65rem; border-radius: 999px; font-size: .75rem; font-weight: 600; letter-spacing: .01em; white-space: nowrap; border: 1px solid transparent; }
.lm-badge::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
.lm-badge--verified { color: var(--lmc-mint); background: rgba(16, 185, 156, .1); border-color: rgba(16, 185, 156, .25); }
.lm-badge--manufacturer { color: var(--lmc-primary); background: rgba(6, 119, 160, .08); border-color: rgba(6, 119, 160, .2); }
.lm-badge--pending { color: var(--lmc-warn); background: rgba(180, 83, 9, .07); border-color: rgba(180, 83, 9, .2); }
.lm-badge--superseded { color: var(--lmc-soft); background: rgba(74, 107, 122, .08); border-color: rgba(74, 107, 122, .2); }

/* ---------- RUO notice ---------- */
.lm-ruo { display: flex; gap: .55rem; align-items: flex-start; margin: 1rem 0 0; padding: .75rem .9rem; border-radius: 12px; background: rgba(234, 249, 252, .8); border: 1px solid var(--lmc-line); color: var(--lmc-soft); font-size: .8125rem; line-height: 1.5; }
.lm-ruo svg { flex: none; margin-top: .1rem; color: var(--lmc-teal); }

/* ---------- Tables ---------- */
.lm-table-wrap { overflow-x: auto; border: 1px solid var(--lmc-line); border-radius: var(--lmc-radius); background: var(--lmc-surface); -webkit-overflow-scrolling: touch; }
.lm-table-wrap:focus-visible { outline: 2px solid var(--lmc-primary); outline-offset: 2px; }
.lm-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.lm-table .lm-badge { white-space: nowrap; }
.lm-table th, .lm-table td { padding: .8rem 1rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--lmc-line); }
.lm-table thead th { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--lmc-soft); background: var(--lmc-ice); font-weight: 600; white-space: nowrap; }
.lm-table tbody tr:last-child > * { border-bottom: 0; }
.lm-table tbody th { font-weight: 600; color: var(--lmc-ink); }
.lm-doc-link { display: inline-block; margin: 0 .5rem .25rem 0; font-weight: 600; color: var(--lmc-primary); }

/* ---------- Batch lookup ---------- */
.lm-batch-lookup__label { display: block; margin-bottom: .4rem; font-weight: 600; font-size: .875rem; }
.lm-batch-lookup__row { display: flex; gap: .5rem; flex-wrap: wrap; }
.lm-batch-lookup__row .lm-input { flex: 1 1 220px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; text-transform: uppercase; }
.lm-batch-lookup__row .lm-input::placeholder { text-transform: none; letter-spacing: 0; font-family: var(--lm-font-body, inherit); }
.lm-batch-lookup__hint { margin: .5rem 0 0; font-size: .8125rem; color: var(--lmc-soft); }
.lm-batch-lookup__result:empty { display: none; }
.lm-batch-lookup__result { margin-top: 1rem; }
.lm-batch-hit { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; padding: 1rem 1.15rem; border-radius: var(--lmc-radius); background: var(--lmc-surface); border: 1px solid var(--lmc-line); box-shadow: var(--lmc-shadow); }
.lm-batch-hit p { margin: 0 0 .2rem; }
.lm-batch-hit__id { font-size: 1.15rem; font-weight: 600; color: var(--lmc-ink); }
.lm-batch-hit__side { display: flex; flex-direction: column; align-items: flex-end; gap: .6rem; }
.lm-batch-miss { padding: .8rem 1rem; border-radius: 12px; background: rgba(180, 83, 9, .06); color: var(--lmc-ink); }

/* ---------- Batch Passport ---------- */
.lm-passport { padding: clamp(1.25rem, 3vw, 2.25rem); border-radius: 24px; background: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .78)); border: 1px solid rgba(255, 255, 255, .9); box-shadow: var(--lmc-shadow), inset 0 0 0 1px var(--lmc-line); }
.lm-passport__head { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: flex-start; padding-bottom: 1.25rem; border-bottom: 1px dashed var(--lmc-line); }
.lm-passport__id { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(1.4rem, 1rem + 1.6vw, 2rem); letter-spacing: .04em; color: var(--lmc-ink); }
.lm-passport__facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem 1.5rem; margin: 1.5rem 0; }
.lm-passport__facts div { min-width: 0; }
.lm-passport__facts dt { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--lmc-soft); }
.lm-passport__facts dd { margin: .2rem 0 0; font-weight: 600; color: var(--lmc-ink); overflow-wrap: anywhere; }
.lm-passport section { margin-top: 1.75rem; }
.lm-passport section > :is(h2, h3, h4) { margin: 0 0 .4rem; font-size: 1.05rem; letter-spacing: -.01em; }
.lm-passport__results--manufacturer .lm-table-wrap { border-style: dashed; }
.lm-doc-list { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .6rem; }
.lm-doc { display: flex; align-items: center; gap: .85rem; padding: .75rem .9rem; border-radius: 14px; border: 1px solid var(--lmc-line); background: var(--lmc-surface); }
.lm-doc__icon { flex: none; display: grid; place-items: center; width: 42px; height: 48px; border-radius: 8px; background: var(--lmc-ice); color: var(--lmc-teal); font-size: .7rem; font-weight: 700; letter-spacing: .06em; }
.lm-doc__meta { display: flex; flex-direction: column; min-width: 0; }
.lm-doc__meta a { font-weight: 600; color: var(--lmc-ink); }
.lm-doc__meta small { color: var(--lmc-soft); }

/* ---------- Spec lists & citations ---------- */
.lm-spec-list { margin: 0; display: grid; gap: 0; border: 1px solid var(--lmc-line); border-radius: var(--lmc-radius); background: var(--lmc-surface); overflow: hidden; }
.lm-spec { display: grid; grid-template-columns: minmax(130px, 34%) 1fr; gap: 1rem; padding: .85rem 1rem; border-bottom: 1px solid var(--lmc-line); }
.lm-spec:last-child { border-bottom: 0; }
.lm-spec dt { color: var(--lmc-soft); font-size: .875rem; }
.lm-spec dd { margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; font-weight: 600; color: var(--lmc-ink); min-width: 0; }
.lm-spec__value { overflow-wrap: anywhere; }
@media (max-width: 520px) { .lm-spec { grid-template-columns: 1fr; gap: .25rem; } }
.lm-citations { margin: 0; padding-left: 1.25rem; display: grid; gap: .6rem; font-size: .9rem; color: var(--lmc-soft); }
.lm-citations a { white-space: nowrap; }

/* ---------- FAQ ---------- */
.lm-faq { display: grid; gap: .6rem; }
.lm-faq__item { border-radius: 16px; background: var(--lmc-surface); border: 1px solid var(--lmc-line); transition: box-shadow .24s var(--lmc-ease), border-color .24s; }
.lm-faq__item[open] { box-shadow: var(--lmc-shadow); border-color: rgba(6, 119, 160, .25); }
.lm-faq__q { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.05rem 1.25rem; cursor: pointer; list-style: none; font-weight: 600; color: var(--lmc-ink); }
.lm-faq__q::-webkit-details-marker { display: none; }
.lm-faq__q:focus-visible { outline: 2px solid var(--lmc-primary); outline-offset: -2px; border-radius: 16px; }
.lm-faq__icon { position: relative; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--lmc-ice); }
.lm-faq__icon::before, .lm-faq__icon::after { content: ""; position: absolute; left: 50%; top: 50%; width: 11px; height: 1.6px; background: var(--lmc-teal); transform: translate(-50%, -50%); transition: transform .24s var(--lmc-ease); }
.lm-faq__icon::after { transform: translate(-50%, -50%) rotate(90deg); }
.lm-faq__item[open] .lm-faq__icon::after { transform: translate(-50%, -50%) rotate(0deg); }
.lm-faq__a { padding: 0 1.25rem 1.15rem; color: var(--lmc-soft); }
.lm-faq__a > :first-child { margin-top: 0; }
.lm-faq__a > :last-child { margin-bottom: 0; }

/* ---------- Forms ---------- */
.lm-form__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; margin-bottom: 1.25rem; }
.lm-field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.lm-field > label { font-size: .875rem; font-weight: 600; color: var(--lmc-ink); }
.lm-field--wide { grid-column: 1 / -1; }
@media (max-width: 640px) { .lm-form__grid { grid-template-columns: 1fr; } }
.lm-check { display: flex; gap: .6rem; align-items: flex-start; font-size: .9rem; line-height: 1.45; color: var(--lmc-ink); cursor: pointer; }
.lm-check input { flex: none; width: 20px; height: 20px; margin: .1rem 0 0; accent-color: var(--lmc-primary); }
.lm-check--sm { font-size: .8125rem; color: var(--lmc-soft); }
.lm-notice { padding: .9rem 1rem; border-radius: 12px; margin-bottom: 1rem; }
.lm-notice--success { background: rgba(16, 185, 156, .1); color: var(--lmc-ink); border: 1px solid rgba(16, 185, 156, .3); }
.lm-notice--error { background: rgba(180, 35, 24, .06); color: var(--lmc-ink); border: 1px solid rgba(180, 35, 24, .25); }
.lm-form-status { margin: .5rem 0 0; min-height: 1.2em; font-size: .875rem; color: var(--lmc-soft); }
.lm-form-status.is-success { color: var(--lmc-mint); font-weight: 600; }
.lm-newsletter__row { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .7rem; }
.lm-newsletter__row .lm-input { flex: 1 1 220px; }
.lm-stock-alert { margin-top: 1rem; padding: 1rem; border-radius: 16px; border: 1px dashed rgba(6, 119, 160, .3); background: rgba(234, 249, 252, .6); }
.lm-stock-alert__title { margin: 0 0 .6rem; font-weight: 600; }

/* ---------- COA library ---------- */
.lm-coa-filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-bottom: 1rem; padding: 1rem; border-radius: var(--lmc-radius); background: var(--lmc-surface); border: 1px solid var(--lmc-line); }
.lm-coa-filters .lm-field { flex: 1 1 200px; }
.lm-coa-count { font-size: .875rem; color: var(--lmc-soft); }
.lm-empty { padding: 2rem; text-align: center; border-radius: var(--lmc-radius); border: 1px dashed var(--lmc-line); background: rgba(255, 255, 255, .6); }
.lm-pagination ul { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; padding: 0; margin: 1.25rem 0 0; }
.lm-pagination a, .lm-pagination span { display: inline-grid; place-items: center; min-width: 40px; min-height: 40px; padding: 0 .75rem; border-radius: 999px; border: 1px solid var(--lmc-line); text-decoration: none; color: var(--lmc-ink); }
.lm-pagination .current { background: var(--lmc-primary); color: #fff; border-color: transparent; }

/* ---------- Compare ---------- */
.lm-compare-toggle { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .7rem; border-radius: 999px; border: 1px solid var(--lmc-line); background: rgba(255, 255, 255, .7); color: var(--lmc-soft); font: 500 .8125rem/1 inherit; cursor: pointer; min-height: 32px; }
.lm-compare-toggle.is-active { color: var(--lmc-primary); border-color: rgba(6, 119, 160, .4); background: rgba(6, 119, 160, .08); }
.lm-compare-tray { position: fixed; z-index: 60; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: .75rem; max-width: calc(100vw - 2rem); padding: .55rem .55rem .55rem 1rem; border-radius: 999px; background: rgba(255, 255, 255, .82); -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4); border: 1px solid rgba(255, 255, 255, .9); box-shadow: var(--lmc-shadow), inset 0 0 0 1px var(--lmc-line); }
.lm-compare-tray__list { display: flex; gap: .4rem; margin: 0; padding: 0; list-style: none; overflow-x: auto; }
.lm-compare-tray__list li { display: flex; align-items: center; gap: .2rem; padding: .25rem .25rem .25rem .6rem; border-radius: 999px; background: var(--lmc-ice); font-size: .8rem; white-space: nowrap; max-width: 180px; }
.lm-compare-tray__list span { overflow: hidden; text-overflow: ellipsis; }
.lm-compare-tray__x { width: 26px; height: 26px; border: 0; border-radius: 50%; background: transparent; cursor: pointer; color: var(--lmc-soft); font-size: 1rem; }
@media (max-width: 640px) { .lm-compare-tray__list { display: none; } .lm-compare-tray { padding: .4rem; } }
.lm-compare__product { display: flex; flex-direction: column; gap: .5rem; font-weight: 600; color: var(--lmc-ink); text-decoration: none; }
.lm-compare__product img { width: 120px; height: auto; border-radius: 12px; }
.lm-table--compare th[scope="row"] { width: 180px; }

/* ---------- Age gate ---------- */
.lm-age-pending .lm-age-gate[hidden] { display: flex; }
.lm-lock, .lm-lock body { overflow: hidden; }
.lm-age-gate { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.lm-age-gate[hidden] { display: none; }
.lm-age-gate__backdrop { position: absolute; inset: 0; background: radial-gradient(circle at 20% 10%, rgba(53, 215, 208, .35), transparent 50%), radial-gradient(circle at 90% 90%, rgba(200, 243, 107, .3), transparent 45%), rgba(234, 249, 252, .72); -webkit-backdrop-filter: blur(22px) saturate(1.3); backdrop-filter: blur(22px) saturate(1.3); }
.lm-age-gate__panel { position: relative; width: min(520px, 100%); max-height: calc(100dvh - 2rem); overflow: auto; padding: clamp(1.5rem, 4vw, 2.5rem); border-radius: 28px; background: rgba(255, 255, 255, .86); border: 1px solid rgba(255, 255, 255, .95); box-shadow: 0 40px 80px -30px rgba(8, 76, 98, .4), inset 0 0 0 1px var(--lmc-line); display: grid; gap: .9rem; animation: lm-rise .42s var(--lmc-ease) both; }
.lm-age-gate__title { margin: 0; font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2rem); line-height: 1.15; color: var(--lmc-ink); }
.lm-age-gate__text { margin: 0 0 .25rem; color: var(--lmc-soft); }
.lm-age-gate__actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .4rem; }
.lm-age-gate__actions .lm-btn--primary { flex: 1 1 auto; }
.lm-age-gate__error { margin: 0; color: var(--lmc-danger); font-size: .875rem; font-weight: 600; }
.lm-age-gate__fine { margin: 0; font-size: .75rem; color: var(--lmc-soft); }
.lm-age-gate.is-leaving { opacity: 0; transition: opacity .24s var(--lmc-ease); }
@keyframes lm-rise { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }

/* ---------- Consent ---------- */
.lm-consent { position: fixed; z-index: 70; left: 1rem; right: 1rem; bottom: max(1rem, env(safe-area-inset-bottom)); margin: 0 auto; max-width: 760px; display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; align-items: center; justify-content: space-between; padding: 1rem 1.15rem; border-radius: 20px; background: rgba(255, 255, 255, .9); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); box-shadow: var(--lmc-shadow), inset 0 0 0 1px var(--lmc-line); font-size: .875rem; color: var(--lmc-ink); }
.lm-consent[hidden] { display: none; }
.lm-consent__text { margin: 0; flex: 1 1 320px; }
.lm-consent__actions { display: flex; gap: .5rem; }

/* ---------- Recently viewed ---------- */
.lm-recent__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
.lm-recent__item { display: flex; flex-direction: column; gap: .4rem; text-decoration: none; color: var(--lmc-ink); }
.lm-recent__item img, .lm-recent__ph { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; background: var(--lmc-ice); }
.lm-recent__name { font-weight: 600; font-size: .9rem; }
.lm-recent__price { font-size: .875rem; color: var(--lmc-soft); }

@media (prefers-reduced-motion: reduce) {
	.lm-age-gate__panel { animation: none; }
	.lm-btn, .lm-faq__item, .lm-faq__icon::before, .lm-faq__icon::after { transition: none; }
}
