/* ---- Kamerové vyhledání produktu (ikona foťáku ve FiboSearch) ----
   Samostatný soubor: načítá se pro VŠECHNY návštěvníky (i bez B2B),
   proto obsahuje i základní styly modalu (scoped na #b2b-cam-search-modal),
   které mají B2B uživatelé jinak v b2b-bar.css. */

/* Základ modalu (scoped) */
/* Z-index musí být NAD popupem FiboSearch (ten má 999999999). */
#b2b-cam-search-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000000000 !important;
}

#b2b-cam-search-modal.active {
    display: block;
}

#b2b-cam-search-modal .b2b-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1;
}

#b2b-cam-search-modal .b2b-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

/* Ikona vlevo v inputu FiboSearch */
.b2b-cams-host {
    position: relative;
}

.b2b-cams-host .dgwt-wcas-search-input {
    padding-right: 44px !important;
}

/* Ikona vpravo: bílá na červeném inputu, černá když má input focus
   (input je po kliknutí bílý). */
.b2b-cams-trigger {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    color: #ffffff;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.15s ease, opacity 0.15s ease;
}

.b2b-cams-host:focus-within .b2b-cams-trigger {
    color: #1d2327;
}

/* Když je v poli text, FiboSearch zobrazuje vlastní křížek pro smazání –
   ikona foťáku by se s ním překrývala, proto ji schováme. Řídí se přímo
   živou hodnotou inputu (:placeholder-shown), takže funguje pro psaní,
   backspace, CTRL+V i smazání křížkem. */
.b2b-cams-host:has(.dgwt-wcas-search-input:not(:placeholder-shown)) .b2b-cams-trigger {
    display: none;
}

.b2b-cams-trigger:hover {
    opacity: 0.75;
}

/* Pod 1368px je ikona vždy černá (input tam není červený). */
@media (max-width: 1367px) {
    .b2b-cams-trigger {
        color: #1d2327;
    }
}

/* Nad 1368px má FiboSearch vpravo tlačítko „Hledat" – ikonu posuneme dál od okraje. */
@media (min-width: 1368px) {
    .b2b-cams-trigger {
        right: 100px;
    }

    .b2b-cams-host .dgwt-wcas-search-input {
        padding-right: 136px !important;
    }
}

.b2b-cams-trigger svg {
    display: block;
}

/* Modal */
.b2b-cam-search-modal .b2b-cam-search-modal-content {
    width: 90%;
    max-width: 420px;
    position: relative;
}

.b2b-cam-search-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    padding: 0;
    line-height: 1;
    font-size: 24px;
    color: #999;
    background: transparent;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    z-index: 5;
    transition: color 0.15s ease, background 0.15s ease;
}

.b2b-cam-search-close:hover {
    color: #333;
    background: #f0f0f0;
}

.b2b-cam-search-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 36px 28px 28px;
    gap: 14px;
}

/* Stav: kamera */
.b2b-cams-camera {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.b2b-cams-hint {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.b2b-cams-frame {
    position: relative;
    width: 100%;
    max-width: 360px;
    aspect-ratio: 4 / 3;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}

.b2b-cams-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.b2b-cams-laser {
    position: absolute;
    left: 8%;
    right: 8%;
    top: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(236, 17, 23, 0), #ec1117 50%, rgba(236, 17, 23, 0));
    box-shadow: 0 0 2px 0 rgba(236, 17, 23, 0.5);
    border-radius: 1px;
    animation: b2b-cams-laser-move 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes b2b-cams-laser-move {
    0%   { top: 6%; }
    50%  { top: 92%; }
    100% { top: 6%; }
}

.b2b-cams-status {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 13px;
}

.b2b-cams-status-error {
    background: rgba(193, 11, 23, 0.85);
}

/* Stav: hledám EAN */
.b2b-cams-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.b2b-cams-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f0e0e0;
    border-top-color: #ec1117;
    border-radius: 50%;
    animation: b2b-cams-spin 0.8s linear infinite;
}

@keyframes b2b-cams-spin {
    to { transform: rotate(360deg); }
}

.b2b-cams-loading-title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: #333;
}

.b2b-cams-loading-code {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #ec1117;
}

/* Stav: nalezený produkt */
.b2b-cams-product {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.b2b-cams-product-img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
}

.b2b-cams-product-name {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.b2b-cams-product-stock {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
}

.b2b-cams-stock-in {
    color: #2e7d32;
}

.b2b-cams-stock-out {
    color: #c10b17;
}

/* Cena (stejná logika jako tabulka variant: B2B bez DPH, B2C bez + s DPH) */
.b2b-cams-product-price {
    margin: 0;
    font-size: 15px;
    line-height: 1.45;
    color: #1d2327;
    text-align: center;
}

.b2b-cams-product-price small {
    font-size: 13px;
    color: #666;
}

.b2b-cams-price-original {
    text-decoration: line-through;
    color: #999;
    font-size: 13px;
}

.b2b-cams-qty-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.b2b-cams-qty-label {
    margin: 0;
    padding: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    color: #333;
    display: flex;
    align-items: center;
}

.b2b-cams-qty {
    width: 80px;
    height: 42px;
    margin: 0;
    padding: 0 10px;
    font-size: 16px;
    line-height: 1;
    text-align: center;
    border: 2px solid #d9d9d9;
    border-radius: 6px;
    background: #fff;
    box-sizing: border-box;
}

.b2b-cams-qty:focus {
    outline: none;
    border-color: #ec1117;
}

/* Varování: qty > sklad — tip se při hoveru přesouvá na body (fixed),
   ať neroztahuje content modalu (transform + overflow scrollbar). */
.b2b-cams-qty-row .price-info-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 2px;
}

.b2b-cams-qty-row .price-info-tooltip .info-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    font-size: 14px;
    cursor: help;
    border-radius: 50%;
    background-color: #f0f0f0;
}

.b2b-cams-qty-row .price-info-tooltip .tooltip-text {
    display: none;
}

.b2b-qty-tooltip-floating {
    display: block !important;
    position: fixed !important;
    width: 260px;
    max-width: calc(100vw - 16px);
    margin: 0 !important;
    padding: 12px 15px;
    background-color: #333;
    color: #fff;
    text-align: left;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.4;
    font-weight: normal;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    z-index: 2147483646 !important;
    visibility: visible;
    opacity: 1;
}

.b2b-qty-tooltip-floating::after {
    content: "";
    position: absolute;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
}

.b2b-qty-tooltip-floating:not(.b2b-qty-tooltip-below)::after {
    top: 100%;
    border-color: #333 transparent transparent transparent;
}

.b2b-qty-tooltip-floating.b2b-qty-tooltip-below::after {
    bottom: 100%;
    border-color: transparent transparent #333 transparent;
}

.b2b-cams-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 420px;
}

.b2b-cams-add-btn {
    flex: 1 1 140px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background-color: #ec1117;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.b2b-cams-add-btn:hover:not(:disabled) {
    background-color: #c10b17;
}

.b2b-cams-add-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.b2b-cams-detail-btn {
    flex: 1 1 140px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background-color: #19ad1b;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease;
    box-sizing: border-box;
}

.b2b-cams-detail-btn:hover,
.b2b-cams-detail-btn:focus {
    color: #fff;
    background-color: #148f16;
    text-decoration: none;
}

.b2b-cams-again-btn {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    background: transparent;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.b2b-cams-again-btn:hover {
    background-color: #f5f5f5;
    border-color: #adb5bd;
}

/* Stav: přidáno do košíku */
.b2b-cams-added {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.b2b-cams-added-icon {
    color: #2e7d32;
}

.b2b-cams-added-text {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

/* Stav: nenalezeno */
.b2b-cams-error {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}
