/* ============================================================
   Lesarome Product Switcher – stylesheet
   ============================================================ */

/* ---- Section wrapper ---- */
.lps-switcher {
    margin-top: 3rem;
    padding-top: 2.5rem;
    border-top: 1px solid #e8e8e8;
}

/* ---- Header ---- */
.lps-switcher__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    gap: 1rem;
}

.lps-switcher__title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #1a1a1a;
    margin: 0;
}

/* ---- Nav buttons ---- */
.lps-switcher__nav {
    display: flex;
    gap: 0.375rem;
}

.lps-nav-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #d0d0d0;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    color: #333;
}

.lps-nav-btn:hover {
    background: #1a1a1a;
    border-color: #1a1a1a;
    color: #fff;
}

.lps-nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ---- Track ---- */
.lps-switcher__track-wrap {
    overflow: hidden;
    position: relative;
}

.lps-switcher__track {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;        /* Firefox */
    padding-bottom: 0.5rem;
}

.lps-switcher__track::-webkit-scrollbar {
    display: none;
}

/* ---- Card ---- */
.lps-card {
    flex: 0 0 160px;
    background: #fff;
    border: 2px solid #e8e8e8;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    position: relative;
    outline: none;
}

.lps-card:hover {
    border-color: #888;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.lps-card:focus-visible {
    border-color: #0071a1;
    box-shadow: 0 0 0 3px rgba(0, 113, 161, 0.25);
}

.lps-card--active {
    border-color: #1a1a1a;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    pointer-events: none;
}

/* Loading state */
.lps-card--loading {
    opacity: 0.6;
    pointer-events: none;
}

.lps-card--loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.55)
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Ccircle cx='20' cy='20' r='16' fill='none' stroke='%23333' stroke-width='3' stroke-dasharray='60 40' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 20 20' to='360 20 20' dur='0.8s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/svg%3E")
        center / 32px no-repeat;
    border-radius: 10px;
}

/* ---- Card image ---- */
.lps-card__img-wrap {
    position: relative;
    aspect-ratio: 1 / 1;
    background: #f5f5f5;
    overflow: hidden;
}

.lps-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.lps-card:hover .lps-card__img {
    transform: scale(1.05);
}

/* ---- Active badge ---- */
.lps-card__badge {
    position: absolute;
    top: 7px;
    left: 7px;
    background: #1a1a1a;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 20px;
    line-height: 1;
}

/* ---- Card body ---- */
.lps-card__body {
    padding: 0.6rem 0.75rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.lps-card__name {
    font-size: 0.78rem;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lps-card__price {
    font-size: 0.78rem;
    color: #555;
}

.lps-card__price .woocommerce-Price-amount {
    font-weight: 700;
    color: #1a1a1a;
}

/* ============================================================
   Product page update overlay
   ============================================================ */

/* Subtle flash when the product updates */
@keyframes lps-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.lps-updated {
    animation: lps-fade-in 0.3s ease forwards;
}

/* ============================================================
   Inline switch preview bar (shown above switcher after switch)
   ============================================================ */
.lps-preview-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    animation: lps-fade-in 0.25s ease;
}

.lps-preview-bar__img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.lps-preview-bar__info {
    flex: 1;
    min-width: 0;
}

.lps-preview-bar__name {
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #1a1a1a;
}

.lps-preview-bar__price {
    font-size: 0.82rem;
    color: #444;
}

.lps-preview-bar__actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.lps-preview-bar__actions .button {
    font-size: 0.75rem !important;
    padding: 0.45em 0.9em !important;
    white-space: nowrap;
}

.lps-btn-cart {
    background: #1a1a1a !important;
    color: #fff !important;
}

.lps-btn-cart:hover {
    background: #333 !important;
}

.lps-btn-view {
    background: transparent !important;
    border: 1px solid #1a1a1a !important;
    color: #1a1a1a !important;
}

.lps-btn-view:hover {
    background: #1a1a1a !important;
    color: #fff !important;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 600px) {
    .lps-card {
        flex: 0 0 130px;
    }

    .lps-preview-bar {
        flex-wrap: wrap;
    }

    .lps-preview-bar__actions {
        width: 100%;
        justify-content: flex-end;
    }
}
