/* Estilos para el Grid Mayorista B2B */

.wdr-wholesale-container {
    padding-bottom: 20px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    position: relative;
}



/* TABLA RESUMEN DE PRECIOS B2B */
.wdr-b2b-tier-summary {
    margin-bottom: 25px;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #eaeaea;
    overflow: hidden;
}

.wdr-b2b-tier-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: center;
}

.wdr-b2b-tier-table thead th {
    background: #f1f1f1;
    color: #555;
    padding: 10px;
    font-weight: 600;
    border-bottom: 1px solid #eaeaea;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.wdr-b2b-tier-table tbody td {
    padding: 10px;
    border-bottom: 1px solid #eaeaea;
    color: #333;
}

.wdr-b2b-tier-table tbody tr:last-child td {
    border-bottom: none;
}

.wdr-b2b-tier-table tbody tr:hover td {
    background: #fdfdfd;
}

.wdr-wholesale-layout {
    display: flex;
    gap: 30px;
}

.wdr-wholesale-main {
    flex: 1;
    min-width: 0;
}

.wdr-wholesale-sidebar {
    width: 340px;
    flex-shrink: 0;
}

.wdr-ws-sidebar-sticky {
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.wdr-ws-desktop-viewer-wrapper {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.4s ease;
}

.wdr-ws-desktop-viewer-wrapper.wdr-is-active {
    grid-template-rows: 1fr;
}

.wdr-ws-desktop-viewer {
    overflow: hidden;
    background: #fff;
    border: 1px solid transparent;
    border-radius: 8px;
    text-align: center;
    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: border-color 0.4s ease, padding 0.4s ease, box-shadow 0.4s ease;
    opacity: 0;
}

.wdr-ws-desktop-viewer-wrapper.wdr-is-active .wdr-ws-desktop-viewer {
    border-color: #eaeaea;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    opacity: 1;
}

.wdr-ws-desktop-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.2s;
    z-index: 2;
}

.wdr-ws-desktop-close:hover {
    color: #e74c3c;
}

.wdr-ws-viewer-img {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 6px;
    animation: wdrFadeIn 0.3s ease;
}

.wdr-ws-viewer-placeholder {
    color: #999;
    font-size: 12px;
    margin: 0;
}

@keyframes wdrFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.wdr-ws-name-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wdr-ws-view-img-mobile {
    display: none;
    font-size: 13px;
    color: #3498db;
    font-weight: 500;
    cursor: pointer;
}

/* Lightbox Base */
.wdr-ws-mobile-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wdr-ws-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.wdr-ws-lightbox-content {
    position: relative;
    z-index: 10;
    max-width: 90%;
    max-height: 90%;
}

.wdr-ws-lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    background: #fff;
}

.wdr-ws-lightbox-close {
    position: absolute;
    top: -45px;
    right: 0;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 40px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    opacity: 0.8;
}

.wdr-ws-lightbox-close:hover {
    opacity: 1;
}

.wdr-wholesale-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    transition: background 0.2s, border-color 0.2s;
    cursor: pointer;
}

.wdr-wholesale-item:hover {
    background: #f1f1f1;
    border-color: #ccc;
}

.wdr-ws-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.wdr-ws-info img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #eee;
}

.wdr-ws-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.wdr-ws-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wdr-ws-btn {
    width: 36px;
    height: 36px;
    border-radius: 5px;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.wdr-ws-btn:hover {
    background: #eee;
    border-color: #bbb;
}

.wdr-ws-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.wdr-ws-input {
    width: 50px;
    height: 36px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    -moz-appearance: textfield;
    appearance: textfield;
}

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

/* Sticky Bottom Bar */
.wdr-ws-sticky-bar {
    position: sticky;
    bottom: -1px;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.05);
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 99;
    border-top: 1px solid #eaeaea;
    margin-top: 20px;
    transition: opacity 0.3s ease;
    border-radius: 0 0 8px 8px;
}

.wdr-ws-bar-content {
    max-width: 1400px;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.wdr-ws-summary {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wdr-ws-total {
    font-size: 18px;
    font-weight: 800;
    color: #111;
}

.wdr-ws-notice {
    font-size: 13px;
    color: #e63946;
    /* Rojo warning */
    font-weight: 600;
}

.wdr-ws-notice.valid {
    color: #2ecc71;
    /* Verde success */
}

/* OUT OF STOCK STYLING */
.wdr-wholesale-item.wdr-out-of-stock {
    opacity: 0.5;
    filter: grayscale(100%);
    position: relative;
}

.wdr-wholesale-item.wdr-out-of-stock::after {
    content: "AGOTADO";
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    background: #e74c3c;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
    z-index: 10;
}

/* Tooltip estético para botones pseudo-disabled */
.wdr-btn-disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
}

[data-wdr-tooltip] {
    position: relative;
}

[data-wdr-tooltip]:hover::after {
    content: attr(data-wdr-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: #e74c3c;
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 100;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    pointer-events: none;
    animation: fadeInTooltip 0.2s ease forwards;
}

@keyframes fadeInTooltip {
    from {
        opacity: 0;
        transform: translate(-50%, 5px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.wdr-ws-submit {
    background: #000;
    color: #fff;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s, opacity 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wdr-ws-submit:hover:not(:disabled) {
    background: #333;
}

.wdr-ws-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
    color: #888;
}

@media (max-width: 768px) {
    .wdr-wholesale-item {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }

    .wdr-ws-info {
        width: 100%;
        flex-basis: 100%;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 15px;
        margin-bottom: 5px;
    }

    .wdr-ws-controls {
        margin-left: 65px;
        /* image size 50px + gap 15px */
        width: calc(100% - 65px);
        justify-content: flex-start;
        background: transparent;
        padding: 0;
        border: none;
    }

    .wdr-ws-input {
        flex: none;
        width: 60px;
        border: 1px solid #ccc;
        background: #fff;
    }

    .wdr-ws-bar-content {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .wdr-ws-submit {
        width: 100%;
        padding: 15px;
    }

    .wdr-wholesale-sidebar {
        width: 100%;
        order: -1;
    }

    .wdr-wholesale-layout {
        flex-direction: column;
        gap: 0;
    }

    .wdr-ws-desktop-viewer-wrapper {
        display: none;
    }

    .wdr-ws-view-img-mobile {
        display: inline-block;
    }
}