/**
 * LGC FloorViz — minimal functional styles v0.1
 * assets/css/engine.css
 *
 * Clean, neutral defaults. Designed to be restyled to match the
 * Lifetime Green Coatings brand in a later pass.
 */

.lgc-floorviz {
    --lgc-text:        #1a2b3c;
    --lgc-muted:       #6b7684;
    --lgc-accent:      #4a7c59;
    --lgc-accent-dark: #2d5a3d;
    --lgc-border:      #e5e7eb;
    --lgc-bg:          #fafbfc;
    --lgc-card:        #ffffff;
    --lgc-radius:      12px;
    --lgc-radius-sm:   8px;

    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    color: var(--lgc-text);
    line-height: 1.5;
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.lgc-floorviz__intro {
    text-align: center;
    margin-bottom: 2rem;
}

.lgc-floorviz__heading {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    letter-spacing: -0.02em;
}

.lgc-floorviz__subheading {
    color: var(--lgc-muted);
    font-size: 1rem;
    margin: 0;
}

.lgc-floorviz__card {
    background: var(--lgc-card);
    border: 1px solid var(--lgc-border);
    border-radius: var(--lgc-radius);
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.lgc-floorviz__body {
    min-height: 360px;
}

.lgc-floorviz__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 360px;
    color: var(--lgc-muted);
}

/* ── Progress ──────────────────────────────────────────── */
.lgc-progress {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.lgc-progress__dot {
    width: 32px;
    height: 4px;
    background: var(--lgc-border);
    border-radius: 2px;
    transition: background 0.3s;
}

.lgc-progress__dot.is-done,
.lgc-progress__dot.is-active {
    background: var(--lgc-accent);
}

/* ── Steps ─────────────────────────────────────────────── */
.lgc-step {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.lgc-step__eyebrow {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--lgc-muted);
    font-weight: 600;
}

.lgc-step__heading {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.015em;
}

.lgc-step__guidance {
    color: var(--lgc-muted);
    margin: 0 0 1rem;
}

.lgc-back {
    background: none;
    border: none;
    color: var(--lgc-muted);
    cursor: pointer;
    font-size: 0.875rem;
    padding: 0;
    align-self: flex-start;
}

.lgc-back:hover {
    color: var(--lgc-text);
}

/* ── Dropzone ──────────────────────────────────────────── */
.lgc-dropzone {
    display: block;
    border: 2px dashed var(--lgc-border);
    border-radius: var(--lgc-radius);
    padding: 3rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.lgc-dropzone:hover {
    border-color: var(--lgc-accent);
    background: var(--lgc-bg);
}

.lgc-dropzone__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.lgc-dropzone__icon {
    font-size: 2.5rem;
    color: var(--lgc-accent);
    line-height: 1;
}

.lgc-dropzone__label {
    font-weight: 600;
    font-size: 1rem;
}

.lgc-dropzone__hint {
    color: var(--lgc-muted);
    font-size: 0.875rem;
}

/* ── Options (application picker) ──────────────────────── */
.lgc-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.lgc-option {
    background: var(--lgc-bg);
    border: 1px solid var(--lgc-border);
    border-radius: var(--lgc-radius-sm);
    padding: 1rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.9375rem;
    font-weight: 500;
}

.lgc-option:hover {
    border-color: var(--lgc-accent);
    transform: translateY(-1px);
}

.lgc-option.is-selected {
    border-color: var(--lgc-accent);
    background: rgba(74, 124, 89, 0.08);
}

/* ── Swatch grid ───────────────────────────────────────── */
.lgc-swatches {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.lgc-swatch {
    background: none;
    border: 2px solid transparent;
    border-radius: var(--lgc-radius-sm);
    padding: 0.25rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: border-color 0.15s;
}

.lgc-swatch:hover {
    border-color: var(--lgc-border);
}

.lgc-swatch.is-selected {
    border-color: var(--lgc-accent);
}

.lgc-swatch__tile {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    background-size: cover;
    background-position: center;
    border-radius: calc(var(--lgc-radius-sm) - 4px);
    background-color: var(--lgc-bg);
}

.lgc-swatch__fallback {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--lgc-muted);
    opacity: 0.5;
    text-transform: uppercase;
}

.lgc-swatch__label {
    font-size: 0.8125rem;
    text-align: center;
    padding: 0 0.25rem 0.25rem;
}

/* ── Buttons ──────────────────────────────────────────── */
.lgc-submit,
.lgc-btn {
    background: var(--lgc-accent);
    color: #fff;
    border: none;
    border-radius: var(--lgc-radius-sm);
    padding: 0.875rem 1.5rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.lgc-submit:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.lgc-submit:not(:disabled):hover,
.lgc-btn--primary:hover {
    background: var(--lgc-accent-dark);
}

.lgc-btn--ghost {
    background: transparent;
    color: var(--lgc-accent);
    border: 1px solid var(--lgc-accent);
}

.lgc-btn--ghost:hover {
    background: rgba(74, 124, 89, 0.08);
}

.lgc-btn--text {
    background: transparent;
    color: var(--lgc-muted);
    padding: 0.5rem;
}

/* ── Processing ───────────────────────────────────────── */
.lgc-processing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 4rem 1rem;
    text-align: center;
}

.lgc-processing__spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--lgc-border);
    border-top-color: var(--lgc-accent);
    border-radius: 50%;
    animation: lgc-spin 0.8s linear infinite;
    margin-bottom: 0.5rem;
}

@keyframes lgc-spin {
    to { transform: rotate(360deg); }
}

.lgc-processing__label {
    color: var(--lgc-accent, #b0571a);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0;
}

.lgc-processing__message {
    color: var(--lgc-text, #1a1a1a);
    font-size: 1.0625rem;
    line-height: 1.5;
    margin: 0;
    max-width: 38rem;
    transition: opacity 0.3s;
}

/* ── Result ───────────────────────────────────────────── */
.lgc-result {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.lgc-compare {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 640px) {
    .lgc-compare { grid-template-columns: 1fr; }
}

/* Result shown without its "before" (source image aged out of retention
   while the result is still live): one centered full-width figure instead
   of a half-empty comparison grid. */
.lgc-compare--single {
    grid-template-columns: 1fr;
    max-width: 560px;
    margin: 0 auto;
}

.lgc-compare__item {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.lgc-compare__item img {
    width: 100%;
    height: auto;
    border-radius: var(--lgc-radius-sm);
    display: block;
}

.lgc-compare__item figcaption {
    font-size: 0.8125rem;
    color: var(--lgc-muted);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ── Intelligence block ───────────────────────────────── */
.lgc-intel {
    background: var(--lgc-bg);
    border-radius: var(--lgc-radius);
    padding: 1.5rem;
}

.lgc-intel__heading {
    margin: 0 0 1rem;
    font-size: 1.125rem;
    font-weight: 700;
}

.lgc-intel__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.lgc-intel__item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.lgc-intel__title {
    font-size: 0.9375rem;
    color: var(--lgc-accent-dark);
}

.lgc-intel__body {
    font-size: 0.875rem;
    color: var(--lgc-muted);
}

/* ── Actions row ──────────────────────────────────────── */
.lgc-result__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

/* ── Error ────────────────────────────────────────────── */
.lgc-error {
    text-align: center;
    padding: 3rem 1rem;
}

.lgc-error__message {
    color: var(--lgc-muted);
    margin-bottom: 1.5rem;
}


/* ═══════════════════════════════════════════════════════
   MODAL + LIGHTBOX
   Rules are deliberately scoped/specific so host-theme
   resets (e.g. `button{background:none;border:none}`)
   cannot strip the styling. Appended last so it also wins
   on equal specificity.
   ═══════════════════════════════════════════════════════ */

body.lgc-modal-open { overflow: hidden; }

.lgc-modal,
.lgc-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    font-family: inherit;
    box-sizing: border-box;
}

.lgc-modal *,
.lgc-lightbox * { box-sizing: border-box; }

.lgc-modal .lgc-modal__backdrop,
.lgc-lightbox .lgc-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26, 43, 60, 0.6);
    animation: lgcFadeIn 0.18s ease-out;
}

/* ── Panel ─────────────────────────────────────────── */
.lgc-modal .lgc-modal__panel {
    position: relative;
    z-index: 1;
    background: #ffffff;
    border-radius: var(--lgc-radius, 12px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 440px;
    padding: 2rem;
    animation: lgcPopIn 0.2s ease-out;
    text-align: left;
}

.lgc-modal .lgc-modal__close,
.lgc-lightbox .lgc-lightbox__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: transparent;
    border: 0;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--lgc-muted, #6b7684);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--lgc-radius-sm, 8px);
    transition: color 0.15s ease, background 0.15s ease;
    width: auto;
    min-width: 0;
}

.lgc-modal .lgc-modal__close:hover,
.lgc-lightbox .lgc-lightbox__close:hover {
    color: var(--lgc-text, #1a2b3c);
    background: var(--lgc-bg, #fafbfc);
}

.lgc-modal .lgc-modal__title {
    margin: 0 0 0.5rem;
    padding: 0;
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--lgc-text, #1a2b3c);
}

.lgc-modal .lgc-modal__text {
    margin: 0 0 1.5rem;
    padding: 0;
    color: var(--lgc-muted, #6b7684);
    font-size: 0.9375rem;
    line-height: 1.55;
}

.lgc-modal .lgc-modal__label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--lgc-text, #1a2b3c);
    margin: 0 0 0.5rem;
    letter-spacing: 0.01em;
}

.lgc-modal .lgc-modal__input {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0.8125rem 1rem;
    border: 1.5px solid var(--lgc-border, #e5e7eb);
    border-radius: var(--lgc-radius-sm, 8px);
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.4;
    color: var(--lgc-text, #1a2b3c);
    background: #ffffff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.lgc-modal .lgc-modal__input::placeholder { color: #9aa3ad; opacity: 1; }

.lgc-modal .lgc-modal__input:focus {
    outline: none;
    border-color: var(--lgc-accent, #4a7c59);
    box-shadow: 0 0 0 3px rgba(74, 124, 89, 0.16);
}

.lgc-modal .lgc-modal__input[aria-invalid="true"] { border-color: #c0392b; }

.lgc-modal .lgc-modal__error {
    margin: 0.5rem 0 0;
    padding: 0;
    color: #c0392b;
    font-size: 0.8125rem;
    line-height: 1.4;
}

.lgc-modal .lgc-modal__actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* ── Buttons inside the modal ──────────────────────────
   Re-declared at higher specificity because host themes
   commonly reset bare `button` elements. ─────────────── */
.lgc-modal .lgc-btn,
.lgc-modal button.lgc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--lgc-accent, #4a7c59);
    color: #ffffff;
    border: none;
    border-radius: var(--lgc-radius-sm, 8px);
    padding: 0.8125rem 1.5rem;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9375rem;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, opacity 0.15s ease;
    width: auto;
    min-width: 0;
}

.lgc-modal .lgc-btn--primary,
.lgc-modal button.lgc-btn--primary {
    background: var(--lgc-accent, #4a7c59);
    color: #ffffff;
}

.lgc-modal .lgc-btn--primary:hover,
.lgc-modal button.lgc-btn--primary:hover {
    background: var(--lgc-accent-dark, #2d5a3d);
    color: #ffffff;
}

.lgc-modal .lgc-btn--primary:disabled,
.lgc-modal button.lgc-btn--primary:disabled {
    opacity: 0.6;
    cursor: default;
}

.lgc-modal .lgc-btn--text,
.lgc-modal button.lgc-btn--text {
    background: transparent;
    color: var(--lgc-muted, #6b7684);
    padding: 0.8125rem 0.75rem;
    font-weight: 500;
}

.lgc-modal .lgc-btn--text:hover,
.lgc-modal button.lgc-btn--text:hover {
    background: transparent;
    color: var(--lgc-text, #1a2b3c);
    text-decoration: underline;
}

/* ── Success state ─────────────────────────────────── */
.lgc-modal .lgc-modal__success { text-align: center; padding: 0.5rem 0; }

.lgc-modal .lgc-modal__check {
    width: 56px;
    height: 56px;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    background: var(--lgc-accent, #4a7c59);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lgc-modal .lgc-modal__success .lgc-modal__title { text-align: center; }
.lgc-modal .lgc-modal__success .lgc-modal__text { text-align: center; margin-bottom: 1.25rem; }

/* ── Lightbox ──────────────────────────────────────── */
.lgc-lightbox .lgc-lightbox__inner {
    position: relative;
    z-index: 1;
    max-width: min(1100px, 94vw);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: lgcPopIn 0.2s ease-out;
}

.lgc-lightbox .lgc-lightbox__img {
    max-width: 100%;
    max-height: 85vh;
    width: auto;
    height: auto;
    border-radius: var(--lgc-radius, 12px);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
    display: block;
}

.lgc-lightbox .lgc-lightbox__caption {
    margin: 0.875rem 0 0;
    padding: 0;
    color: #ffffff;
    font-size: 0.8125rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.lgc-lightbox .lgc-lightbox__close {
    top: -2.75rem;
    right: 0;
    color: #ffffff;
    font-size: 2rem;
}

.lgc-lightbox .lgc-lightbox__close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
}

/* ── Zoomable result images ────────────────────────── */
.lgc-compare__item .lgc-compare__zoom,
button.lgc-compare__zoom {
    display: block;
    position: relative;
    padding: 0;
    margin: 0;
    border: 0;
    background: none;
    cursor: zoom-in;
    width: 100%;
    border-radius: var(--lgc-radius-sm, 8px);
    overflow: hidden;
    line-height: 0;
}

.lgc-compare__zoom img { display: block; width: 100%; height: auto; }

.lgc-compare__zoom .lgc-compare__zoom-icon {
    position: absolute;
    right: 0.625rem;
    bottom: 0.625rem;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(26, 43, 60, 0.65);
    color: #ffffff;
    opacity: 0;
    transition: opacity 0.18s ease;
    pointer-events: none;
}

.lgc-compare__zoom:hover .lgc-compare__zoom-icon,
.lgc-compare__zoom:focus-visible .lgc-compare__zoom-icon { opacity: 1; }

.lgc-compare__zoom:focus-visible {
    outline: 2px solid var(--lgc-accent, #4a7c59);
    outline-offset: 2px;
}

/* ── Inline notice (replaces native alert) ─────────── */
.lgc-notice {
    margin: 1rem auto 0;
    max-width: 32rem;
    padding: 0.75rem 1rem;
    background: #fdf2f0;
    border: 1px solid #f0c7bf;
    border-radius: var(--lgc-radius-sm, 8px);
    color: #98392b;
    font-size: 0.9375rem;
    line-height: 1.45;
    text-align: center;
}

@keyframes lgcFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes lgcPopIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .lgc-modal .lgc-modal__backdrop,
    .lgc-lightbox .lgc-lightbox__backdrop,
    .lgc-modal .lgc-modal__panel,
    .lgc-lightbox .lgc-lightbox__inner { animation: none; }
}

@media (max-width: 520px) {
    .lgc-modal .lgc-modal__panel { padding: 1.5rem 1.25rem; }
    .lgc-modal .lgc-modal__actions { flex-direction: column-reverse; align-items: stretch; }
    .lgc-modal .lgc-btn { width: 100%; }
    .lgc-lightbox .lgc-lightbox__close { top: -2.25rem; }
}