/* ==========================================================================
   LeviShop Pricing Calculator — Frontend Styles
   Reference: Express cups / LimePack-style UI
   ========================================================================== */

:root {
    --lpc-accent: #22c55e;
    --lpc-accent-hover: #16a34a;
    --lpc-accent-light: #dcfce7;
    --lpc-slider-fill: #22c55e;
    --lpc-slider-track: #e5e7eb;
}

.lpc-calculator {
    margin: 24px 0;
    font-family: inherit;
    min-height: 420px;
}

/* ---- Attribute groups ---- */
.lpc-attr-group {
    margin-bottom: 24px;
}

.lpc-attr-label {
    display: block;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 8px;
    color: #1f2937;
    letter-spacing: 0.02em;
}

/* ---- Horizontal scroll wrapper (LimePack-style) ---- */
.lpc-scroll-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lpc-scroll-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #f3f4f6;
    color: #374151;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: opacity 0.2s, background 0.2s;
    opacity: 0;
}

.lpc-scroll-wrapper:hover .lpc-scroll-btn {
    opacity: 1;
}

.lpc-scroll-wrapper:hover .lpc-scroll-btn:hover {
    background: #e5e7eb;
}

.lpc-scroll-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.lpc-scroll-wrapper.lpc-at-start .lpc-scroll-left,
.lpc-scroll-wrapper.lpc-at-end .lpc-scroll-right {
    opacity: 0.25;
    pointer-events: none;
}

.lpc-radio-cards-wrapper {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.lpc-radio-cards-wrapper::-webkit-scrollbar {
    display: none;
}

/* ---- Radio cards (single row on mobile, wrap on desktop) ---- */
.lpc-radio-cards {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    padding: 4px 0;
}

@media (min-width: 768px) {
    .lpc-radio-cards-wrapper {
        overflow-x: visible;
    }

    .lpc-radio-cards {
        flex-wrap: wrap;
    }

    .lpc-radio-card {
        flex: 1 1 calc(25% - 8px);
        min-width: 88px;
    }

    .lpc-scroll-wrapper .lpc-scroll-btn {
        display: none;
    }
}

/* Mobile: horizontal scroll for option cards */
@media (max-width: 767px) {
    .lpc-radio-cards-wrapper {
        overflow-x: auto;
    }

    .lpc-radio-cards {
        flex-wrap: nowrap;
    }

    .lpc-radio-card {
        flex: 0 0 auto;
    }

    .lpc-scroll-wrapper .lpc-scroll-btn {
        display: flex;
    }
}

.lpc-radio-card {
    position: relative;
    cursor: pointer;
    flex: 0 0 auto;
}

.lpc-radio-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.lpc-card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    box-sizing: border-box;
    padding: 12px 18px;
    border: 2px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    transition: all 0.2s ease;
    text-align: center;
}

.lpc-radio-card:hover:not(.lpc-disabled) .lpc-card-body {
    border-color: #9ca3af;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.lpc-radio-card.lpc-selected .lpc-card-body,
.lpc-radio-card input:checked + .lpc-card-body {
    border-color: var(--lpc-accent);
    background: var(--lpc-accent-light);
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.lpc-card-title {
    font-weight: 600;
    font-size: 14px;
    color: #1f2937;
    line-height: 1.3;
}

.lpc-card-surcharge {
    margin-top: 4px;
    font-size: 11px;
    color: #6b7280;
    font-weight: 500;
}

.lpc-card-subtitle {
    font-weight: 500;
    color: #6b7280;
}

.lpc-radio-card.lpc-selected .lpc-card-surcharge {
    color: var(--lpc-accent-hover);
}

/* ---- Disabled (unavailable variation) ---- */
.lpc-radio-card.lpc-disabled {
    cursor: not-allowed;
    pointer-events: none;
}

.lpc-radio-card.lpc-hidden {
    display: none !important;
}

.lpc-radio-card.lpc-disabled .lpc-card-body {
    border-color: #e5e7eb;
    background: #f3f4f6;
    box-shadow: none;
    opacity: 0.45;
}

.lpc-radio-card.lpc-disabled .lpc-card-title {
    color: #9ca3af;
    text-decoration: line-through;
    text-decoration-color: #d1d5db;
}

.lpc-radio-card.lpc-disabled .lpc-card-surcharge {
    color: #d1d5db;
}

/* ---- Quantity group (Menge) ---- */
.lpc-qty-group {
    margin-bottom: 24px;
    border: 0;
    padding: 0;
    min-width: 0;
}

.lpc-qty-group > legend.lpc-attr-label {
    padding: 0;
    margin-bottom: 8px;
}

.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

.lpc-qty-number-label {
    display: block;
    width: fit-content;
}

.lpc-qty-range-label {
    display: block;
    width: 100%;
}

.lpc-qty-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lpc-qty-input {
    width: 140px;
    padding: 10px 16px;
    border: 2px solid #d1d5db;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

.lpc-qty-input:focus {
    border-color: var(--lpc-accent);
}

/* Slider with fill (green on left, grey on right) */
.lpc-slider-wrap {
    position: relative;
    width: 100%;
}

.lpc-qty-range {
    display: block;
    width: 100%;
    height: 10px;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border-radius: 5px;
    outline: none;
}

/* Track */
.lpc-qty-range::-webkit-slider-runnable-track {
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(
        to right,
        var(--lpc-slider-fill) 0%,
        var(--lpc-slider-fill) var(--lpc-slider-percent, 0%),
        var(--lpc-slider-track) var(--lpc-slider-percent, 0%),
        var(--lpc-slider-track) 100%
    );
}

.lpc-qty-range::-moz-range-track {
    height: 10px;
    border-radius: 5px;
    background: var(--lpc-slider-track);
}

.lpc-qty-range::-moz-range-progress {
    height: 10px;
    border-radius: 5px 0 0 5px;
    background: var(--lpc-slider-fill);
}

/* Thumb */
.lpc-qty-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--lpc-accent);
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    margin-top: -7px;
}

.lpc-qty-range::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--lpc-accent);
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Tier hints — 2 равных столбца, плашки одинаковой ширины */
.lpc-tier-hints {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
}

.lpc-tier-hint {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 8px 12px;
    background: #f3f4f6;
    border-radius: 8px;
    font-size: 12px;
    color: #6b7280;
    transition: all 0.2s;
    border: 1px solid transparent;
    box-sizing: border-box;
    text-align: center;
    appearance: none;
    font-family: inherit;
    cursor: pointer;
}

.lpc-tier-hint:not(.lpc-tier-hidden):not(:disabled):hover {
    background: #e5e7eb;
    border-color: #d1d5db;
    color: #374151;
}

.lpc-tier-hint:not(.lpc-tier-hidden):not(:disabled):active {
    transform: scale(0.98);
}

.lpc-tier-hint.lpc-tier-hidden {
    display: none !important;
}

.lpc-tier-hint.lpc-tier-active {
    background: var(--lpc-accent-light);
    color: var(--lpc-accent-hover);
    border-color: #86efac;
    font-weight: 600;
}

.lpc-tier-hint.lpc-tier-active:hover {
    background: var(--lpc-accent-light);
    border-color: #4ade80;
    color: var(--lpc-accent-hover);
}

@media (min-width: 768px) {
    .lpc-tier-hints {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1200px) {
    .lpc-tier-hints {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ---- Price display ---- */
.lpc-price-display {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 18px 22px;
    margin-bottom: 24px;
}

.lpc-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.lpc-price-row + .lpc-price-row {
    border-top: 1px solid #e5e7eb;
}

.lpc-price-label {
    font-size: 15px;
    color: #4b5563;
    font-weight: 600;
}

.lpc-price-value {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
}

.lpc-price-total .lpc-price-label {
    font-size: 17px;
    font-weight: 700;
    color: #1f2937;
}

.lpc-price-total .lpc-price-value {
    font-size: 24px;
    color: var(--lpc-accent-hover);
}

.lpc-price-total-incl {
    border-top: none;
    padding-top: 4px;
}

.lpc-price-total-gross {
    border-top: 1px solid #e5e7eb;
    margin-top: 4px;
    padding-top: 8px;
}

.lpc-price-total-gross .lpc-price-label {
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
}

.lpc-price-total-gross .lpc-price-value {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
}

.lpc-price-label--sub {
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
}

.lpc-price-value--sub {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
}

/* ---- Delivery info (product page) ---- */
.lpc-delivery-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px 18px;
    background: linear-gradient(135deg, #f0fdf4 0%, #f8fafc 100%);
    border: 1px solid #bbf7d0;
    border-radius: 12px;
}

.lpc-delivery-info__row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.lpc-delivery-info__icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #ffffff;
    color: var(--lpc-accent-hover);
    border: 1px solid #dcfce7;
}

.lpc-delivery-info__content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.lpc-delivery-info__label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6b7280;
}

.lpc-delivery-info__value {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.4;
}

.lpc-delivery-info__value.is-free {
    color: var(--lpc-accent-hover);
}

.lpc-delivery-info__value--date {
    font-size: 14px;
    font-weight: 600;
    color: #14532d;
}

/* ---- Add to cart ---- */
.lpc-add-to-cart {
    margin-top: 4px;
}

.lpc-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 16px 28px !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    text-align: center;
    border-radius: 12px !important;
    background: var(--lpc-accent) !important;
    color: #fff !important;
    border: none !important;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.28);
    transition: transform 0.18s cubic-bezier(0.34, 1.2, 0.64, 1), box-shadow 0.18s ease, background 0.18s ease;
    line-height: 1.4 !important;
}

.lpc-add-btn:hover:not(:disabled) {
    background: var(--lpc-accent-hover) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(34, 197, 94, 0.34);
}

.lpc-add-btn:active:not(:disabled),
.lpc-add-btn.is-pressed:not(:disabled) {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.22);
}

.lpc-add-btn:disabled {
    background: #9ca3b8 !important;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Cart message (legacy fallback, hidden — toast is used instead) */
.lpc-cart-message {
    display: none;
}

/* Toast notification (below header, does not cover cart icon) */
.lpc-toast-root {
    position: fixed;
    top: 72px;
    right: 16px;
    z-index: 99990;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: min(360px, calc(100vw - 32px));
}

.lpc-toast {
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: #fff;
    background: rgba(22, 163, 74, 0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow: 0 8px 28px rgba(22, 163, 74, 0.22), 0 2px 8px rgba(0, 0, 0, 0.08);
    opacity: 0;
    transform: translateX(16px);
    transition: opacity 0.32s ease, transform 0.32s ease;
}

.lpc-toast--error {
    background: rgba(220, 38, 38, 0.85);
    box-shadow: 0 8px 28px rgba(220, 38, 38, 0.2), 0 2px 8px rgba(0, 0, 0, 0.08);
}

.lpc-toast.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.lpc-toast.is-hiding {
    opacity: 0;
    transform: translateY(-8px);
}

/* Fly-to-cart ghost image */
.lpc-fly-to-cart {
    position: fixed;
    z-index: 99999;
    border-radius: 10px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    pointer-events: none;
    transform: translate(0, 0) scale(1);
    transform-origin: center center;
    opacity: 1;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.6s ease;
    will-change: transform, opacity;
}

.header-cart.lpc-cart-bump {
    animation: lpc-cart-bump 0.45s ease;
}

@keyframes lpc-cart-bump {
    0%, 100% { transform: scale(1); }
    40% { transform: scale(1.18); }
}

@media (prefers-reduced-motion: reduce) {
    .lpc-fly-to-cart,
    .header-cart.lpc-cart-bump {
        animation: none;
        transition: none;
    }

    .lpc-toast {
        transform: none;
    }
}

@media (max-width: 768px) {
    .lpc-toast-root {
        top: 64px;
        right: 12px;
        left: 12px;
        max-width: none;
    }
}

/* ---- Responsive: Tablet ---- */
@media (max-width: 768px) {
    .lpc-calculator {
        margin: 16px 0;
    }

    .lpc-attr-group {
        margin-bottom: 18px;
    }

    .lpc-attr-label {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .lpc-card-body {
        min-width: 72px;
        padding: 10px 14px;
    }

    .lpc-card-title {
        font-size: 13px;
    }

    .lpc-qty-group {
        margin-bottom: 18px;
    }

    .lpc-price-display {
        padding: 14px 18px;
        margin-bottom: 18px;
    }

    .lpc-price-total .lpc-price-value {
        font-size: 20px;
    }
}

/* ---- Responsive: Mobile — LimePack-style blocks ---- */
@media (max-width: 600px) {
    .lpc-calculator {
        margin: 12px 0;
        padding: 0 2px;
    }

    .lpc-attr-group {
        margin-bottom: 14px;
        padding: 12px 0;
        background: transparent;
        border: none;
        border-radius: 0;
    }

    .lpc-attr-label {
        font-size: 12px;
        font-weight: 600;
        margin-bottom: 8px;
        color: #374151;
        text-transform: none;
        letter-spacing: 0;
    }

    .lpc-scroll-wrapper {
        gap: 4px;
    }

    .lpc-scroll-btn {
        opacity: 1;
        width: 28px;
        height: 28px;
        font-size: 16px;
        background: #fff;
        border: 1px solid #e5e7eb;
        flex-shrink: 0;
    }

    .lpc-scroll-wrapper.lpc-at-start .lpc-scroll-left,
    .lpc-scroll-wrapper.lpc-at-end .lpc-scroll-right {
        opacity: 0.4;
    }

    .lpc-radio-cards {
        gap: 8px;
        padding: 2px 0;
    }

    .lpc-card-body {
        min-width: 64px;
        padding: 8px 12px;
        border-radius: 8px;
        border-width: 2px;
    }

    .lpc-card-title {
        font-size: 12px;
        font-weight: 600;
    }

    .lpc-card-surcharge {
        font-size: 10px;
        margin-top: 2px;
    }

    /* Quantity block */
    .lpc-qty-group {
        margin-bottom: 14px;
        padding: 12px 0;
        background: transparent;
        border: none;
        border-radius: 0;
    }

    .lpc-qty-controls {
        gap: 8px;
    }

    .lpc-qty-input {
        width: 100%;
        max-width: 120px;
        padding: 8px 12px;
        font-size: 16px;
        margin: 0 auto;
        display: block;
    }

    .lpc-slider-wrap {
        margin-top: 4px;
    }

    .lpc-qty-range::-webkit-slider-thumb {
        width: 22px;
        height: 22px;
    }

    .lpc-qty-range::-moz-range-thumb {
        width: 22px;
        height: 22px;
    }

    /* Tier hints — compact grid, smaller text */
    .lpc-tier-hints {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        margin-top: 10px;
    }

    .lpc-tier-hint {
        padding: 6px 10px;
        font-size: 11px;
        border-radius: 6px;
    }

    .lpc-tier-hint.lpc-tier-active {
        font-size: 11px;
    }

    /* Price block — LimePack-style prominent block */
    .lpc-price-display {
        padding: 14px 16px;
        margin-bottom: 14px;
        border-radius: 10px;
        background: #f8fafc;
        border: 1px solid #e5e7eb;
    }

    .lpc-price-row {
        padding: 6px 0;
    }

    .lpc-price-label {
        font-size: 13px;
    }

    .lpc-price-value {
        font-size: 14px;
    }

    .lpc-price-total {
        margin-top: 4px;
        padding-top: 10px;
        border-top: 1px solid #e5e7eb;
    }

    .lpc-price-total .lpc-price-label {
        font-size: 14px;
    }

    .lpc-price-total .lpc-price-value {
        font-size: 20px;
        color: var(--lpc-accent-hover);
    }

    /* Add to cart */
    .lpc-add-btn {
        padding: 14px 20px !important;
        font-size: 15px !important;
        border-radius: 10px !important;
    }
}

/* ==========================================================================
   Single Product Layout Overrides (when calculator is present)
   - Gallery fills image column; card wrap handled above
   - No rounded corners on gallery images
   ========================================================================== */

.single-product-content .single-product__summary {
    min-width: 0;
}

.single-product-content .single-product__images {
    min-width: 0;
    width: 100%;
}

/* --- Tablet & mobile: stacked layout — gallery full width, calculator below --- */
@media (max-width: 1024px) {
    .single-product-content .single-product__grid {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto auto;
    }

    .single-product-content .single-product__images {
        order: 1;
        position: static;
        min-width: 0 !important;
        width: 100%;
    }

    .single-product-content .single-product__summary {
        order: 2;
        width: 100%;
        max-width: 100%;
        padding: 0;
    }

    .single-product-content .woocommerce-product-gallery {
        width: 100% !important;
        max-width: none !important;
        margin-bottom: 0;
    }

    .single-product-content .levishop-gallery--compact .flex-control-thumbs {
        margin-top: 0 !important;
    }
}

/* Desktop side-by-side: gallery needs a minimum width */
@media (min-width: 1025px) {
    .single-product-content .single-product__images {
        min-width: 460px;
    }
}

/* Gallery & viewport fill the column width.
   IMPORTANT: do NOT override width on __wrapper — FlexSlider needs it
   wider than 100 % to lay slides side-by-side. */
.single-product-content .woocommerce-product-gallery,
.single-product-content .woocommerce-product-gallery .flex-viewport {
    width: 100% !important;
}

@media (max-width: 1024px) {
    .single-product-content .woocommerce-product-gallery.levishop-gallery--compact,
    .single-product-content .woocommerce-product-gallery:has(.flex-control-thumbs li:nth-child(2)) {
        width: 100% !important;
        max-width: none !important;
    }

    .single-product-content .woocommerce-product-gallery .flex-control-thumbs {
        margin-top: 0 !important;
    }
}

@media (min-width: 1025px) {
    /* Отступ между основным изображением и превью — desktop only */
    .single-product-content .woocommerce-product-gallery .flex-control-thumbs {
        margin-top: 12px;
    }
}

/* --- No border-radius --- */
.single-product-content .woocommerce-product-gallery__image img,
.single-product-content .woocommerce-product-gallery__image,
.single-product-content .woocommerce-product-gallery .flex-control-thumbs img {
    border-radius: 0 !important;
}

/* --- Tablet portrait: stacked layout polish (iPad Air, etc.) --- */
@media (min-width: 768px) and (max-width: 1024px) {
    .lpc-calculator {
        margin: 8px 0 28px;
    }

    .lpc-attr-group {
        margin-bottom: 22px;
    }

    .lpc-attr-label {
        font-size: 14px;
        margin-bottom: 8px;
    }

    .lpc-card-body {
        padding: 14px 16px;
    }

    .lpc-qty-group {
        margin-bottom: 22px;
    }

    .lpc-tier-hints {
        gap: 10px;
        margin-top: 14px;
    }

    .lpc-tier-hint {
        padding: 10px 14px;
        font-size: 13px;
    }

    .lpc-price-display {
        padding: 16px 20px;
    }
}

/* --- Mobile: compact product summary when calculator present --- */
@media (max-width: 600px) {
    .single-product-content .single-product__grid {
        gap: 16px;
        margin-bottom: 20px;
    }

    .single-product-content .single-product__summary {
        padding: 0;
        width: 100%;
        max-width: 100%;
    }

    .single-product-content .product_title {
        font-size: 1.25rem;
        margin-bottom: 10px;
    }

    .single-product-content .woocommerce-product-details__short-description {
        margin-bottom: 12px;
        font-size: 0.875rem;
    }
}
