/* PrestaShop Module: siw_voorraadstatus */
/* Voorraadstatus styling — gelijk aan sov-product-compatibility */

/* ============================================================
   1. WRAPPER + CONTAINER
   Zelfde opzet als .sov-product-compatibility:
   afgeronde container met border, overflow hidden.
   ============================================================ */
.siw-voorraadstatus-wrapper {
    width: 100% !important;
}

.siw-voorraadstatus-container {
    width: 100%;
    box-sizing: border-box;
    margin: 1.5rem 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: visible;
    background: #fff;
}

/* ============================================================
   2. TITEL — zwarte balk bovenin, zoals .sov-compatibility-title
   ============================================================ */
.siw-voorraad-title {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
    padding: .75rem 1rem;
    background: #000;
    font-size: .75rem;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid #e0e0e0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-radius: 8px 8px 0 0;
}

/* ============================================================
   2b. INFO POPUP — tooltip naast titel
   ============================================================ */
.siw-info-trigger {
    margin-left: auto;
    cursor: pointer;
    position: relative;
    color: #fff;
    line-height: 1;
    display: flex;
    align-items: center;
}

.siw-info-icon {
    display: block;
    width: 14px;
    height: 14px;
}

.siw-info-trigger:hover,
.siw-info-trigger:focus {
    color: rgba(255, 255, 255, 0.7);
}

.siw-info-popup {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 8px;
    width: 260px;
    padding: 10px 12px;
    background: #333;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 400;
    line-height: 1.45;
    text-transform: none;
    letter-spacing: 0;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    z-index: 9999;
    white-space: normal;
}

.siw-info-popup::before {
    content: '';
    position: absolute;
    bottom: 100%;
    right: 8px;
    border: 6px solid transparent;
    border-bottom-color: #333;
}

.siw-info-trigger:hover .siw-info-popup,
.siw-info-trigger:focus .siw-info-popup {
    display: block;
}

/* ============================================================
   3. TABEL-WRAPPER — scrollbaar met max hoogte
   ============================================================ */
.siw-voorraad-table-wrapper {
    width: 100%;
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
    border-radius: 0 0 8px 8px;
}

/* ============================================================
   4. TABEL
   ============================================================ */
.siw-voorraad-variants {
    width: 100%;
    margin: 0;
    background: #fff;
    font-size: 0.75rem;
    table-layout: auto;
    border-collapse: collapse;
}

.siw-voorraad-variants thead th {
    background: #fafafa;
    padding: .6rem .75rem;
    font-weight: 600;
    font-size: 0.75rem;
    border-bottom: 2px solid #e0e0e0;
    text-align: left;
    color: #444;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.siw-voorraad-variants tbody td {
    padding: .5rem .75rem;
    vertical-align: middle;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
    font-size: 0.75rem;
}

.siw-voorraad-variants tbody tr:last-child td {
    border-bottom: none;
}

.siw-voorraad-variants tbody tr:hover {
    background-color: #f9f9f9;
}

/* ============================================================
   5. STATUS DOTS & TEKST
   ============================================================ */
.siw-variant-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.siw-status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.15);
}

.siw-status-dot.siw-status-available {
    background-color: var(--siw-voorraad-color-in-stock, #28a745);
}

.siw-status-dot.siw-status-unavailable,
.siw-status-dot.siw-status-preorder {
    background-color: var(--siw-voorraad-color-out-of-stock, #dc3545);
}

/* Eigen magazijnvoorraad — NL vlag status */
.siw-status-dot.siw-status-own-stock {
    background-color: var(--siw-voorraad-color-in-stock, #28a745);
    box-shadow: 0 0 4px rgba(40, 167, 69, 0.4);
}

.siw-own-stock-flag,
.siw-supplier-flag {
    vertical-align: middle;
    margin-left: 2px;
    display: inline;
}

.siw-flag-img {
    vertical-align: middle;
    display: inline-block;
    width: 16px;
    height: 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.siw-status-text {
    font-size: 0.75rem;
    color: #666;
    font-weight: 500;
}

.siw-available-date {
    margin-left: auto;
    font-size: 0.65rem;
    color: #999;
    font-weight: 400;
    white-space: nowrap;
}

/* ============================================================
   6. VARIANT NAAM
   ============================================================ */
.siw-variant-name {
    font-weight: 500;
    color: #222;
    width: auto;
    min-width: 30%;
    white-space: nowrap;
}

.siw-variant-reference {
    color: #888;
    font-size: 0.8rem;
}

/* ============================================================
   7. RESPONSIVE — card layout op mobiel, gelijk aan sov-compatibility
   ============================================================ */
@media (max-width: 640px) {
    .siw-voorraad-variants thead {
        display: none;
    }
    .siw-voorraad-variants tbody tr {
        display: flex;
        align-items: center;
        padding: .4rem .75rem;
        border-bottom: 1px solid #eee;
        gap: .5rem;
    }
    .siw-voorraad-variants tbody td {
        display: flex;
        align-items: center;
        padding: 0;
        border-bottom: none;
    }
    .siw-voorraad-variants tbody td.siw-variant-name {
        flex-shrink: 0;
        white-space: nowrap;
        font-size: 0.7rem;
    }
    .siw-voorraad-variants tbody td::before {
        display: none;
    }
    .siw-voorraad-title {
        font-size: 0.7rem;
    }
    .siw-status-dot {
        width: 8px;
        height: 8px;
    }
    .siw-status-text {
        font-size: 0.7rem;
    }
    .siw-variant-status {
        gap: 0.35rem;
    }
}

/* ============================================================
   8. PRE-ORDER KNOP
   ============================================================ */
.product-add-to-cart .add-to-cart[data-button-action="add-to-cart"].siw-preorder-mode {
    background-color: #ff9800 !important;
    border-color: #ff9800 !important;
}

.product-add-to-cart .add-to-cart[data-button-action="add-to-cart"].siw-preorder-mode:hover {
    background-color: #f57c00 !important;
    border-color: #ef6c00 !important;
}

/* ============================================================
   9. ENKEL PRODUCT (ZONDER TABEL)
   ============================================================ */
.siw-voorraad-single {
    padding: 8px 12px;
    border-radius: 0 0 8px 8px;
}

/* ============================================================
   10. INLINE LEVERSTATUS (WINKELWAGEN + ORDER-DETAIL)
   ============================================================ */
.siw-delivery-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    line-height: 1.2;
}

.siw-delivery-inline .siw-status-dot {
    width: 8px;
    height: 8px;
}

.siw-delivery-inline .siw-status-text {
    font-size: 0.72rem;
    color: #555;
}

.siw-delivery-inline .siw-available-date {
    font-size: 0.65rem;
    color: #999;
    margin-left: 0;
}

.siw-cart-delivery-status {
    margin-top: 4px;
}

.siw-order-delivery-status {
    margin-top: 3px;
    margin-bottom: 2px;
}

@media (max-width: 640px) {
    .siw-delivery-inline .siw-status-dot {
        width: 7px;
        height: 7px;
    }
    .siw-delivery-inline .siw-status-text {
        font-size: 0.68rem;
    }
}

/* Mobiel order-detail layout (.order-items) */
.order-items .siw-order-delivery-status {
    margin-top: 2px;
    margin-bottom: 1px;
}

.order-items .siw-order-delivery-note {
    margin-top: 1px;
    margin-bottom: 1px;
}

.order-items .siw-ready-for-shipping {
    margin-top: 1px;
    margin-bottom: 2px;
}

@media (max-width: 767px) {
    .siw-order-delivery-status .siw-delivery-inline {
        font-size: 0.7rem;
    }
    .siw-order-delivery-status .siw-delivery-inline .siw-status-dot {
        width: 6px;
        height: 6px;
    }
    .siw-order-delivery-status .siw-delivery-inline .siw-status-text {
        font-size: 0.7rem;
    }
    .siw-order-delivery-note .siw-note-badge {
        font-size: 0.7rem;
    }
    .siw-ready-for-shipping .siw-ready-badge {
        font-size: 0.7rem;
    }
}

/* ============================================================
   11. NOTITIE BIJ ORDER-DETAIL (FRONT-END)
   ============================================================ */
.siw-order-delivery-note {
    margin-top: 2px;
    margin-bottom: 4px;
    line-height: 1.3;
}

.siw-note-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.72rem;
    font-weight: 500;
    color: #856404;
    line-height: 1.3;
}

/* ============================================================
   12. KLAAR VOOR VERZENDING BADGE (FRONT-END ORDER-DETAIL)
   ============================================================ */
.siw-ready-for-shipping {
    margin-top: 2px;
    margin-bottom: 4px;
}

.siw-ready-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #28a745;
    line-height: 1.3;
}
