/* =========================================
   Floating Cart Bar – Styles v1.2.0
   ========================================= */

:root {
    --fcb-bg: #ffffff;
    --fcb-border: #e0e0e0;
    --fcb-text: #111111;
    --fcb-text-muted: #555555;
    --fcb-gold: #BD9E5E;
    --fcb-gold-hover: #BD9E5E;
    --fcb-gold-active: #a07a2e;
    --fcb-gold-text: #ffffff;
    --fcb-shadow: 0 -4px 20px rgba(0, 0, 0, 0.10), 0 -1px 4px rgba(0, 0, 0, 0.05);
    --fcb-transition: 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    --fcb-z: 99999;
    --fcb-height: 68px;
}

/* ¦¦ Bar container ¦¦ */
.fcb-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--fcb-z);
    background: var(--fcb-bg);
    border-top: 1px solid var(--fcb-border);
    box-shadow: var(--fcb-shadow);
    transform: translateY(100%);
    transition: transform var(--fcb-transition), opacity var(--fcb-transition);
    opacity: 0;
    will-change: transform;
}
@media (max-width: 480px) {
/* ¦¦ Bar container ¦¦ */
.fcb-bar {
    position: fixed;
    bottom: 40px;
    left: 0;
    right: 0;
    z-index: var(--fcb-z);
    background: var(--fcb-bg);
    border-top: 1px solid var(--fcb-border);
    box-shadow: var(--fcb-shadow);
    transform: none;
    transition: none;
    opacity: 0;
    will-change: transform;
}
}

.fcb-bar.fcb-visible {
    transform: translateY(0);
    opacity: 1;
}

.fcb-bar.fcb-hidden {
    pointer-events: none;
}

/* ¦¦ Inner layout ¦¦
   Używamy tych samych marginesów co motyw (max-width + padding).
   Zakładamy max-width: 1280px z padding: 0 24px — dostosuj jeśli motyw używa innej wartości.
   ¦¦ */
.fcb-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1450px;          /* dopasuj do max-width kontenera motywu */
    margin: 0 auto;
    padding: 0 24px;            /* dopasuj do padding kontenera motywu */
    height: var(--fcb-height);
    box-sizing: border-box;
}

/* ¦¦ Lewa strona: miniatura + nazwa ¦¦ */
.fcb-product-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.fcb-thumbnail {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    overflow: hidden;
    border: 1px solid var(--fcb-border);
    background: #f5f5f5;
}

.fcb-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.fcb-name {
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--fcb-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 450px;
    line-height: 1.3;
}
@media (max-width: 480px) {
.fcb-name {
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--fcb-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
    line-height: 1.3;
}
}

/* ¦¦ Prawa strona: combo + cena + ilość + przycisk ¦¦ */
.fcb-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* ¦¦ Cena ¦¦ */
.fcb-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--fcb-text);
    white-space: nowrap;
    line-height: 1;
    flex-shrink: 0;
}

.fcb-price .woocommerce-Price-amount,
.fcb-price .amount {
    color: var(--fcb-text);
    font-size: inherit;
}

.fcb-price del {
    opacity: 0.5;
    font-weight: 400;
    font-size: 12px;
    margin-right: 4px;
}

.fcb-price ins {
    text-decoration: none;
}

/* ========================================
   COMBO DROPDOWN – wybór wariantu jako
   lista kombinacji: "Kolor / Lakier / Brak"
   ======================================== */

.fcb-combo-wrap {
    position: relative;
    flex-shrink: 0;
}

/* ¦¦ Trigger button ¦¦ */
.fcb-combo-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 14px;
    border: 1.5px solid var(--fcb-border);
    background: #fafafa;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--fcb-text);
    white-space: nowrap;
    max-width: 220px;
    min-width: 140px;
    transition: border-color 0.15s ease, background 0.15s ease;
    box-sizing: border-box;
    outline: none;
}

.fcb-combo-btn:hover {
    border-color: var(--fcb-gold);
    background: #fff;
}

.fcb-combo-btn[aria-expanded="true"] {
    border-color: var(--fcb-gold);
    background: #fff;
}

.fcb-combo-btn[aria-expanded="true"] .fcb-combo-arrow {
    transform: rotate(180deg);
}

.fcb-combo-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.fcb-combo-arrow {
    flex-shrink: 0;
    color: var(--fcb-text-muted);
    transition: transform 0.2s ease;
}

/* ¦¦ Dropdown list ¦¦ */
.fcb-combo-list {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);  /* otwiera się ku górze */
    right: 0;
    min-width: 100%;
    max-width: 340px;
    max-height: 280px;
    overflow-y: auto;
    background: #ffffff;
    border: 1.5px solid var(--fcb-border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    z-index: calc(var(--fcb-z) + 2);
    margin: 0;
    padding: 4px 0;
    list-style: none;
    box-sizing: border-box;
    /* Scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: var(--fcb-border) transparent;
}

.fcb-combo-list::-webkit-scrollbar {
    width: 4px;
}
.fcb-combo-list::-webkit-scrollbar-thumb {
    background: var(--fcb-border);
}

.fcb-combo-list.fcb-combo-open {
    display: block;
}

/* ¦¦ Dropdown items ¦¦ */
.fcb-combo-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--fcb-text);
    cursor: pointer;
    transition: background 0.12s ease;
    line-height: 1.35;
    white-space: normal;    /* allow wrapping for long labels */
}

.fcb-combo-item:hover {
    background: #f5f5f5;
}

.fcb-combo-item--active {
    background: #fdf8ee;
    color: var(--fcb-gold);
    font-weight: 700;
}

.fcb-combo-item--active:hover {
    background: #faf0d6;
}

.fcb-combo-item--oos {
    opacity: 0.55;
    cursor: default;
    pointer-events: none;
}

.fcb-combo-item__text {
    flex: 1;
}

.fcb-combo-item__oos {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: #999;
    background: #f0f0f0;
    padding: 2px 6px;
    white-space: nowrap;
}

/* ¦¦ Quantity ¦¦ */
.fcb-qty-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--fcb-border);
    overflow: hidden;
    background: #fafafa;
    height: 42px;
    flex-shrink: 0;
}

.fcb-qty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 100%;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    font-weight: 300;
    color: var(--fcb-text);
    transition: background 0.15s ease;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
    user-select: none;
}

.fcb-qty-btn:hover {
    background: #f0f0f0;
    color: var(--fcb-gold);
}

.fcb-qty-btn:active {
    background: #e8e8e8;
}

.fcb-qty-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.fcb-qty-input {
    width: 40px;
    height: 100%;
    border: none;
    border-left: 1.5px solid var(--fcb-border);
    border-right: 1.5px solid var(--fcb-border);
    background: #ffffff;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--fcb-text);
    padding: 0 4px;
    box-sizing: border-box;
    -moz-appearance: textfield;
    outline: none;
}

.fcb-qty-input::-webkit-outer-spin-button,
.fcb-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ¦¦ Add to cart button ¦¦ */
.fcb-add-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 22px;
    height: 42px;
    background: var(--fcb-gold);
    color: var(--fcb-gold-text);
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
    text-transform: uppercase;
    font-family: inherit;
    transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 8px rgba(201, 168, 76, 0.3);
    flex-shrink: 0;
}

.fcb-add-btn:hover {
    background: var(--fcb-gold-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(201, 168, 76, 0.40);
}

.fcb-add-btn:active {
    background: var(--fcb-gold-active);
    transform: translateY(0);
    box-shadow: none;
}

.fcb-add-btn:disabled {
    background: #cccccc;
    color: #888888;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.fcb-add-btn.fcb-loading {
    pointer-events: none;
    opacity: 0.80;
}

.fcb-add-btn.fcb-success {
    background: #2e7d32;
    box-shadow: none;
}

.fcb-add-btn.fcb-error {
    background: #c62828;
    box-shadow: none;
}

.fcb-btn-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* ¦¦ Spinner ¦¦ */
@keyframes fcb-spin {
    to { transform: rotate(360deg); }
}

.fcb-spinner {
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: fcb-spin 0.7s linear infinite;
    flex-shrink: 0;
}

/* ¦¦ Checkmark animation ¦¦ */
@keyframes fcb-check {
    0%   { stroke-dashoffset: 24; }
    100% { stroke-dashoffset: 0; }
}

.fcb-check-icon path {
    stroke-dasharray: 24;
    stroke-dashoffset: 24;
    animation: fcb-check 0.35s ease forwards;
}

/* ¦¦ Toast notification ¦¦ */
.fcb-toast {
    position: fixed;
    bottom: calc(var(--fcb-height) + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #111111;
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    padding: 10px 20px;
    opacity: 0;
    pointer-events: none;
    z-index: calc(var(--fcb-z) + 1);
    white-space: nowrap;
    transition: opacity 0.25s ease, transform 0.25s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
}

.fcb-toast.fcb-toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.fcb-toast.fcb-toast-success { background: #2e7d32; }
.fcb-toast.fcb-toast-error   { background: #c62828; }

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1080px) {
    .fcb-name {
        max-width: 200px;
    }
    .fcb-combo-btn {
        max-width: 180px;
        min-width: 120px;
        font-size: 12px;
    }
    .fcb-add-btn {
        padding: 0 16px;
        font-size: 12px;
    }
}

@media (max-width: 900px) {
    .fcb-inner {
        gap: 10px;
    }
    .fcb-name {
        max-width: 140px;
    }
    .fcb-combo-btn {
        max-width: 160px;
        min-width: 100px;
        padding: 0 10px;
    }
    .fcb-add-btn {
        padding: 0 14px;
        gap: 6px;
    }
    .fcb-add-btn .fcb-btn-text {
        display: none;   /* tylko ikona koszyka na mniejszych desktopach */
    }
    .fcb-add-btn {
        padding: 0 14px;
    }
}

/* MOBILE – tylko: miniatura · cena · ilość · przycisk */
@media (max-width: 640px) {
    :root {
        --fcb-height: 60px;
    }

    .fcb-inner {
        padding: 0 16px;
        gap: 10px;
    }

    /* Ukryj nazwę i warianty na mobile */
    .fcb-name {
        display: none;
    }

    .fcb-combo-wrap {
        display: none;
    }

    .fcb-thumbnail {
        width: 38px;
        height: 38px;
    }

    .fcb-price {
        font-size: 13px;
    }

    .fcb-qty-wrap {
        height: 38px;
    }

    .fcb-qty-btn {
        width: 28px;
        font-size: 16px;
    }

    .fcb-qty-input {
        width: 32px;
        font-size: 13px;
    }

    .fcb-add-btn {
        height: 38px;
        padding: 0 14px;
        font-size: 11px;
        gap: 5px;
        letter-spacing: 0.3px;
    }

    /* Pokaż tekst z powrotem na mobile (schowany był na 640–900) */
    .fcb-add-btn .fcb-btn-text {
        display: inline;
    }

    .fcb-btn-icon svg {
        width: 14px;
        height: 14px;
    }
}