/* =========================================================
   Product Color Switcher — Frontend Styles
   Brand color: #b22222
   ========================================================= */

:root {
    --pcs-brand: #b22222;
    --pcs-brand-light: rgba(178, 34, 34, 0.15);
    --pcs-radius: 8px;
    --pcs-gap: 8px;
}

/* ── Container ──────────────────────────────────────────── */
.pcs-color-switcher {
    margin: 14px 0 18px;
    font-family: inherit;
}

/* ── Label ──────────────────────────────────────────────── */
.pcs-label {
    margin: 0 0 10px;
    font-size: .85em;
    font-weight: 700;
    color: #444;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.pcs-active-name {
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--pcs-brand);
}

/* ── Swatch List ────────────────────────────────────────── */
.pcs-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: var(--pcs-gap);
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

.pcs-swatch-item {
    flex: 0 0 auto;
}

/* ── Swatch Link ────────────────────────────────────────── */
.pcs-swatch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px 5px 6px;
    border: 1.5px solid #e0e0e0;
    border-radius: var(--pcs-radius);
    text-decoration: none;
    color: #444;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .1s;
    font-size: .82rem;
    font-weight: 500;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

/* ── Dot ────────────────────────────────────────────────── */
.pcs-swatch-dot {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--pcs-color, #ccc);
    border: 1.5px solid rgba(0,0,0,.10);
    flex-shrink: 0;
    transition: transform .1s;
}

/* ── Hover ──────────────────────────────────────────────── */
.pcs-swatch:hover,
.pcs-swatch:focus-visible {
    border-color: var(--pcs-brand);
    box-shadow: 0 0 0 3px var(--pcs-brand-light);
    color: var(--pcs-brand);
    transform: translateY(-1px);
    text-decoration: none;
}

.pcs-swatch:hover .pcs-swatch-dot {
    transform: scale(1.08);
}

/* ── Active ─────────────────────────────────────────────── */
.pcs-swatch--active {
    border-color: var(--pcs-brand);
    box-shadow: 0 0 0 3px var(--pcs-brand-light);
    color: var(--pcs-brand);
    font-weight: 700;
    pointer-events: none;
    cursor: default;
    background: #fff;
}

.pcs-swatch--active .pcs-swatch-dot {
    box-shadow:
        0 0 0 2px #fff,
        0 0 0 4px var(--pcs-brand);
}

/* ── Focus ──────────────────────────────────────────────── */
.pcs-swatch:focus { outline: none; }
.pcs-swatch:focus-visible {
    outline: 2px solid var(--pcs-brand);
    outline-offset: 2px;
}

/* ── Mobile — یک خط، اسکرول افقی ──────────────────────── */
@media (max-width: 600px) {
    .pcs-swatches {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
        gap: 6px;
    }
    .pcs-swatches::-webkit-scrollbar { display: none; }

    .pcs-swatch {
        padding: 5px 9px 5px 5px;
        font-size: .78rem;
        flex-shrink: 0;
    }

    .pcs-swatch-dot {
        width: 17px;
        height: 17px;
    }
}

/* ── Reduced Motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .pcs-swatch,
    .pcs-swatch-dot { transition: none; }
    .pcs-swatch:hover { transform: none; }
}
