/* =========================================================
   SPACING BUILDER — Components preview
   assets/css/pages/spacing-builder/preview/components-preview.css
   =========================================================
   Chrome only (colors / borders / radius / typography). All spacing
   (padding, gaps) is set inline as var(--sp-*) by the preview module.
   Chrome colors use the shared --preview-* palette.
   ========================================================= */

.sp-cp {
    background: var(--preview-surface);
    color: var(--preview-text);
    border: 1px solid var(--preview-border);
    border-radius: 12px;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.sp-cp h4,
.sp-cp p { margin: 0; }


/* ── Demo tile wrapper ── */
.sp-cp-tile {
    background: var(--preview-bg);
    border: 1px solid var(--preview-border);
    border-radius: 10px;
}

.sp-cp-tile-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--preview-muted);
}


/* ── Button ── */
.sp-cp-btn {
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.sp-cp-btn--primary {
    background: var(--preview-accent);
    color: var(--preview-accent-ct);
}

.sp-cp-btn--ghost {
    background: transparent;
    color: var(--preview-text);
    border: 1px solid var(--preview-border);
}

.sp-cp-btn--icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--preview-bg);
    color: var(--preview-muted);
    border: 1px solid var(--preview-border);
}

.sp-cp-btn-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--preview-accent-ct);
    opacity: 0.8;
    flex-shrink: 0;
}

.sp-cp-btn-dots {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--preview-muted);
    box-shadow: 6px 0 0 var(--preview-muted), -6px 0 0 var(--preview-muted);
}


/* ── Input field ── */
.sp-cp-field-label { font-size: 0.75rem; font-weight: 600; color: var(--preview-text); }

.sp-cp-input {
    border: 1px solid var(--preview-border);
    border-radius: 8px;
    background: var(--preview-bg);
}

.sp-cp-input-icon {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: var(--preview-muted);
    opacity: 0.45;
    flex-shrink: 0;
}

.sp-cp-input-text { color: var(--preview-muted); font-size: 0.82rem; }

.sp-cp-field-help { font-size: 0.72rem; color: var(--preview-muted); font-weight: 500; }


/* ── Card ── */
.sp-cp-card {
    background: var(--preview-surface);
    border: 1px solid var(--preview-border);
    border-radius: 8px;
}

.sp-cp-card-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--preview-accent);
    opacity: 0.9;
}

.sp-cp-card-badge {
    align-self: flex-start;
    padding: 2px 8px;
    border-radius: 9999px;
    background: var(--preview-accent);
    color: var(--preview-accent-ct);
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sp-cp-card-title { font-size: 0.9rem; font-weight: 700; color: var(--preview-text); }

.sp-cp-card-text { color: var(--preview-muted); font-size: 0.8rem; line-height: 1.4; margin-top: -3px; }

.sp-cp-card-cta { margin-top: -3px; }


/* ── List ── */
.sp-cp-list {
    background: var(--preview-bg);
    border: 1px solid var(--preview-border);
    border-radius: 8px;
    overflow: hidden;
}

.sp-cp-list-item {
    border-bottom: 1px solid var(--preview-border);
}

.sp-cp-list-item:last-child { border-bottom: none; }

.sp-cp-list-icon {
    width: 8px;
    height: 8px;
    border-radius: 3px;
    background: var(--preview-accent);
    flex-shrink: 0;
}

.sp-cp-list-label { font-size: 0.82rem; color: var(--preview-text); }

.sp-cp-list-badge {
    padding: 1px 7px;
    border-radius: 9999px;
    background: var(--preview-surface);
    color: var(--preview-muted);
    font-size: 0.68rem;
    font-weight: 700;
    flex-shrink: 0;
}


/* =========================================================
   MOBILE FRAME — collapse the 2-column tile grid
   ========================================================= */
.sp-preview-root--mobile .sp-cp {
    grid-template-columns: 1fr !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
}


/* =========================================================
   SPACING OVERLAY — guide lines/labels shown when the overlay
   toggle is ON. Sits as a sibling of .sp-cp inside the mount
   container (set to position:relative by components-preview.js).
   ========================================================= */
.sp-cp-overlay-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}

.sp-cp-ov-line {
    position: absolute;
}

.sp-cp-ov-line--v {
    width: 0;
    border-left: 1px dashed var(--preview-muted);
    opacity: 0.42;
    transform: translateX(-50%);
}

.sp-cp-ov-line--h {
    height: 0;
    border-top: 1px dashed var(--preview-muted);
    opacity: 0.42;
    transform: translateY(-50%);
}

.sp-cp-ov-line--v::before,
.sp-cp-ov-line--v::after {
    content: "";
    position: absolute;
    left: -4px;
    width: 8px;
    height: 0;
    border-top: 1px solid var(--preview-muted);
    opacity: 0.42;
}
.sp-cp-ov-line--v::before { top: 0; }
.sp-cp-ov-line--v::after  { bottom: 0; }

.sp-cp-ov-line--h::before,
.sp-cp-ov-line--h::after {
    content: "";
    position: absolute;
    top: -4px;
    height: 8px;
    width: 0;
    border-left: 1px solid var(--preview-muted);
    opacity: 0.42;
}
.sp-cp-ov-line--h::before { left: 0; }
.sp-cp-ov-line--h::after  { right: 0; }

.sp-cp-ov-label {
    position: absolute;
    transform: translate(-50%, -50%);
    background: var(--preview-surface);
    color: var(--preview-text);
    border: 1px solid var(--preview-muted);
    box-shadow: var(--shadow-sm);
    opacity: 0.74;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    padding: 4px 9px;
    border-radius: 9999px;
    white-space: nowrap;
}

.sp-cp-ov-corner {
    position: absolute;
    width: 8px;
    height: 8px;
    opacity: 0.42;
}
.sp-cp-ov-corner--tl { border-top: 1.5px solid var(--preview-muted); border-left: 1.5px solid var(--preview-muted); }
.sp-cp-ov-corner--tr { border-top: 1.5px solid var(--preview-muted); border-right: 1.5px solid var(--preview-muted); }
.sp-cp-ov-corner--bl { border-bottom: 1.5px solid var(--preview-muted); border-left: 1.5px solid var(--preview-muted); }
.sp-cp-ov-corner--br { border-bottom: 1.5px solid var(--preview-muted); border-right: 1.5px solid var(--preview-muted); }
