/**
 * NetStore Enterprise – Related Products CSS
 * Loaded on catalog_product_view via catalog_product_view.xml
 */

/* 13. RELATED PRODUCTS */
.ns-related {
    background: var(--ns-bg-white);
    border-top: 1px solid var(--ns-border);
    padding: 52px 24px 60px;
}
.ns-related__inner {
    max-width: 1280px;
    margin: 0 auto;
}
.ns-related__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}
.ns-related__eyebrow {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ns-accent);
    margin-bottom: 2px;
}
.ns-related__title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--ns-navy);
    letter-spacing: -0.02em;
    margin: 0;
}
.ns-related__view-all {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ns-accent);
    text-decoration: none;
    border-bottom: 1.5px solid rgba(0, 115, 230, 0.3);
    padding-bottom: 1px;
    transition: border-color 0.2s;
    white-space: nowrap;
}
.ns-related__view-all:hover {
    border-color: var(--ns-accent);
    color: var(--ns-accent);
}
.ns-related__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}
.ns-related__card {
    background: var(--ns-bg-white);
    border: 1px solid var(--ns-border);
    border-radius: var(--ns-radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    animation: ns-fade-up 0.45s ease both;
    transition:
        box-shadow 0.22s,
        border-color 0.22s,
        transform 0.22s;
}
.ns-related__card:nth-child(1) {
    animation-delay: 0.05s;
}
.ns-related__card:nth-child(2) {
    animation-delay: 0.1s;
}
.ns-related__card:nth-child(3) {
    animation-delay: 0.15s;
}
.ns-related__card:nth-child(4) {
    animation-delay: 0.2s;
}
.ns-related__card:hover {
    box-shadow: var(--ns-shadow-md);
    border-color: #c8d6eb;
    transform: translateY(-3px);
    color: inherit;
    text-decoration: none;
}
.ns-related__img-wrap {
    background: var(--ns-bg-section);
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.ns-related__img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 16px;
    transition: transform 0.4s cubic-bezier(0.22, 0.68, 0, 1.2);
}
.ns-related__card:hover .ns-related__img-wrap img {
    transform: scale(1.07);
}
.ns-related__badge {
    z-index: 99;
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 7px;
    border-radius: 3px;
    color: white;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ns-related__badge--refurbished,
.ns-related__badge--refurb {
    background: linear-gradient(135deg, #1557b0, #0073e6);
}
.ns-related__badge--new {
    background: var(--ns-green);
}
.ns-related__badge--used {
    background: #6b7280;
}
.ns-related__body {
    padding: 14px 16px 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ns-related__brand {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ns-accent);
}
.ns-related__name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ns-navy);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ns-related__sku {
    font-family: var(--ns-mono);
    font-size: 0.7rem;
    color: var(--ns-text-light);
}
.ns-related__price {
    margin-top: 6px;
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.ns-related__price-final {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ns-navy);
}
.ns-related__price-old {
    font-size: 0.75rem;
    color: var(--ns-text-light);
    text-decoration: line-through;
}
.ns-related__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 14px;
    border-top: 1px solid var(--ns-border-light);
    margin-top: auto;
}
.ns-related__stock {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--ns-green);
}
.ns-related__stock-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ns-green);
    flex-shrink: 0;
}
.ns-related__action {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ns-accent);
    background: rgba(0, 115, 230, 0.07);
    border-radius: 4px;
    padding: 5px 10px;
    transition: background 0.18s;
}
.ns-related__card:hover .ns-related__action {
    background: rgba(0, 115, 230, 0.14);
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    .ns-related__grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 900px) {
    .ns-related__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 768px) {
    .ns-related__header {
        flex-direction: row;
        align-items: flex-end;
        gap: 8px;
    }
    .ns-related {
        padding: 36px 16px 48px;
    }
}
@media (max-width: 600px) {
    .ns-related__grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .ns-related__card {
        flex-direction: column;
    }
    .ns-related__img-wrap {
        min-width: 110px;
        aspect-ratio: 16 / 7;
        border-radius: var(--ns-radius-lg) var(--ns-radius-lg) 0 0;
    }
    .ns-related__body {
        padding: 10px 14px 6px;
        gap: 2px;
    }
    .ns-related__brand {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .ns-related__name {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
    }
    .ns-related__sku {
        display: none;
    }
    .ns-related__footer {
        padding: 8px 14px 10px;
    }
    .ns-related__stock {
        font-size: 0.7rem;
    }
    .ns-related__action {
        font-size: 0.72rem;
        padding: 4px 8px;
    }
    .ns-related__price-final {
        font-size: 0.92rem;
    }
}
@media (max-width: 480px) {
    .ns-related {
        padding: 28px 12px 40px;
    }
    .ns-related__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .ns-related__img-wrap {
        aspect-ratio: 4 / 3;
    }
    .ns-related__body {
        padding: 8px 10px 4px;
    }
    .ns-related__footer {
        padding: 6px 10px 8px;
    }
    .ns-related__name {
        font-size: 0.78rem;
    }
    .ns-related__price-final {
        font-size: 0.85rem;
    }
    .ns-related__action {
        display: none;
    }
    .ns-related__stock {
        margin-right: 6px;
    }
}
/* ══════════════════════════════════════════════════
   PRODUCT GRID — Category / Search pages
   Dùng cùng card style với Related Products
══════════════════════════════════════════════════ */
.products-grid .product-items {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 20px !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}
.products-grid .product-item {
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
}
/* Responsive */
@media (max-width: 1024px) {
    .products-grid .product-items {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}
@media (max-width: 720px) {
    .products-grid .product-items {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
@media (max-width: 480px) {
    .products-grid .product-items {
        grid-template-columns: 1fr !important;
    }
}
