/**
 * HockeySweaters Stock Overview Page
 *
 * Visual stock matrix per product.
 * Kleuren als rijen (links), maten als kolommen (boven), gesorteerd XS→5XL.
 */

/* ─── Page wrapper ─── */
.hs-stock-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ─── Header: zoeken + legenda ─── */
.hs-stock-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e0e0e0;
}

.hs-stock-search {
    flex: 1;
    min-width: 220px;
    max-width: 400px;
}

.hs-stock-search input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.hs-stock-search input:focus {
    outline: none;
    border-color: #009ee0;
    box-shadow: 0 0 0 3px rgba(0, 158, 224, 0.1);
}

/* Legenda */
.hs-stock-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.hs-stock-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #555;
    font-weight: 500;
}

.hs-stock-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

.hs-stock-dot.hs-stock-high {
    background: #4CAF50;
}

.hs-stock-dot.hs-stock-low {
    background: #FF9800;
}

.hs-stock-dot.hs-stock-out {
    background: #E0E0E0;
}

/* ─── Product kaart ─── */
.hs-stock-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.hs-stock-card:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.hs-stock-card.hs-hidden {
    display: none;
}

.hs-stock-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    gap: 12px;
}

.hs-stock-card-info {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.hs-stock-thumb img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.hs-stock-card-title h3 {
    margin: 0 0 2px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.hs-stock-card-title h3 a {
    color: #081F2C;
    text-decoration: none;
}

.hs-stock-card-title h3 a:hover {
    color: #009ee0;
}

.hs-stock-sku {
    font-size: 12px;
    color: #888;
    font-weight: 500;
}

.hs-stock-total {
    font-size: 13px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
}

.hs-stock-total.hs-stock-high {
    background: #E8F5E9;
    color: #2E7D32;
}

.hs-stock-total.hs-stock-low {
    background: #FFF3E0;
    color: #E65100;
}

.hs-stock-total.hs-stock-out {
    background: #FAFAFA;
    color: #999;
}

/* ─── Stock matrix tabel ─── */
.hs-stock-matrix-wrap {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

.hs-stock-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 400px;
}

/* Kolomheaders: maten */
.hs-stock-matrix thead th {
    padding: 10px 8px;
    text-align: center;
    background: #fafafa;
    border-bottom: 2px solid #e0e0e0;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
    vertical-align: middle;
}

.hs-stock-color-col-header {
    text-align: left !important;
    padding-left: 16px !important;
    min-width: 160px;
    width: 180px;
}

.hs-stock-size-col-header {
    min-width: 50px;
}

/* Rij-header: kleur (swatch + naam) */
.hs-stock-color-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    white-space: nowrap;
    min-width: 160px;
}

.hs-stock-color-swatch {
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s;
}

/* Groot kleurvlak bij hover / tap */
.hs-stock-color-swatch::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    width: 80px;
    height: 80px;
    border-radius: 12px;
    background-color: inherit;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25), 0 0 0 2px rgba(255, 255, 255, 0.9);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 100;

    /* Kleurnaam als tekst in het vlak */
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 4px 6px;
    font-size: 9px;
    font-weight: 600;
    line-height: 1.1;
    text-align: center;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

/* Lichte kleuren: donkere tekst */
.hs-stock-color-swatch[style*="#FFFFFF"]::after,
.hs-stock-color-swatch[style*="#fff"]::after,
.hs-stock-color-swatch[style*="#D9E1E2"]::after,
.hs-stock-color-swatch[style*="#B8CCEA"]::after,
.hs-stock-color-swatch[style*="#F4C2C2"]::after,
.hs-stock-color-swatch[style*="#E8FF00"]::after,
.hs-stock-color-swatch[style*="#FEDB00"]::after,
.hs-stock-color-swatch[style*="#F5B6CD"]::after,
.hs-stock-color-swatch[style*="#A2AAAD"]::after {
    color: #333;
    text-shadow: none;
}

.hs-stock-color-swatch:hover::after,
.hs-stock-color-swatch:focus::after,
.hs-stock-color-swatch:active::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* Pijltje onderaan de popup */
.hs-stock-color-swatch::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(255, 255, 255, 0.9);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 101;
}

.hs-stock-color-swatch:hover::before,
.hs-stock-color-swatch:focus::before,
.hs-stock-color-swatch:active::before {
    opacity: 1;
}

/* Eerste rij: popup naar beneden i.p.v. boven (voorkomt afsnijding) */
.hs-stock-matrix tbody tr:first-child .hs-stock-color-swatch::after {
    bottom: auto;
    top: calc(100% + 8px);
}

.hs-stock-matrix tbody tr:first-child .hs-stock-color-swatch::before {
    bottom: auto;
    top: calc(100% + 2px);
    border-top-color: transparent;
    border-bottom-color: rgba(255, 255, 255, 0.9);
}

.hs-stock-color-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tabel body */
.hs-stock-matrix tbody tr {
    border-bottom: 1px solid #f0f0f0;
}

.hs-stock-matrix tbody tr:last-child {
    border-bottom: none;
}

.hs-stock-matrix tbody tr:hover {
    background: #f8f9fa;
}

/* Voorraadcellen met kleurindicatie */
.hs-stock-cell {
    padding: 8px 6px;
    text-align: center;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    min-width: 50px;
    transition: background 0.15s;
}

.hs-stock-cell.hs-stock-high {
    background: #E8F5E9;
    color: #2E7D32;
}

.hs-stock-cell.hs-stock-low {
    background: #FFF3E0;
    color: #E65100;
}

.hs-stock-cell.hs-stock-out {
    background: #FAFAFA;
    color: #ccc;
}

/* ─── Footer ─── */
.hs-stock-footer {
    margin-top: 16px;
    padding: 12px 0;
    text-align: center;
    color: #999;
    font-size: 12px;
    border-top: 1px solid #e0e0e0;
}

.hs-stock-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 15px;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .hs-stock-header {
        flex-direction: column;
        align-items: stretch;
    }

    .hs-stock-search {
        max-width: none;
    }

    .hs-stock-card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .hs-stock-thumb img {
        width: 44px;
        height: 44px;
    }

    .hs-stock-card-title h3 {
        font-size: 14px;
    }

    .hs-stock-color-col-header {
        min-width: 120px;
        width: 130px;
        padding-left: 10px !important;
    }

    .hs-stock-color-cell {
        gap: 6px;
        padding: 6px 10px;
        min-width: 120px;
    }

    .hs-stock-color-swatch {
        width: 18px;
        height: 18px;
    }

    .hs-stock-color-name {
        font-size: 11px;
    }

    .hs-stock-cell {
        min-width: 40px;
        padding: 6px 4px;
        font-size: 12px;
    }

    .hs-stock-size-col-header {
        min-width: 40px;
        font-size: 12px;
    }
}
