/*
 * Seven Role Carousel — 90/10 Layout + Anchor/Relative
 * - Khu vực carousel: 90% chiều cao
 * - Khu vực nút:      10% chiều cao
 * - Định vị 3D: .card-anchor (absolute)
 * - Thân card:  .product-box  (relative, không rời flow của anchor)
 */

.scom-carousel-wrapper * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ---------- Khung tổng ---------- */
.scom-carousel-wrapper {
    width: 100%;
    height: 100vh;
    /* luôn chiếm full màn hình */
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow: hidden;
}

/* 90% trên: vùng carousel */
.scom-carousel-main {
    flex: 9;
    /* 90% */
    min-height: 0;
    /* tránh overflow trong flex */
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1800px;
    overflow: hidden;
}

/* 10% dưới: vùng nút */
.scom-carousel-buttons {
    flex: 1;
    /* 10% */
    min-height: 56px;
    /* đảm bảo đủ chỗ cho 2 hàng nút trên mobile */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px 16px;
    background: #fff;
    z-index: 1;
}

.scom-title-buttons {
    display: grid;
    grid-template-columns: repeat(7, 145px);
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.scom-title-button {
    background: transparent;
    border: 2px solid #c1121f;
    color: #c1121f;
    border-radius: 9999px;
    padding: 8px 14px;
    font-size: 0.8rem;
    white-space: nowrap;
    cursor: pointer;
    transition: background .2s ease, color .2s ease, transform .2s ease, border-color .2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scom-title-button:hover {
    background: rgba(193, 18, 31, .08);
}

.scom-title-button.active {
    background: #c1121f;
    color: #fff;
}

.scom-title-button:focus-visible {
    outline: 2px dashed #c1121f;
    outline-offset: 2px;
}

/* ---------- Carousel ---------- */
.carousel {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    transition: transform .35s ease-out;
    z-index: 2;
    /* cao hơn vùng nút nhưng đã tách khu khác nhau nên không che */
}

.carousel:active {
    cursor: grabbing;
}

/* Anchor chịu 3D + neo tâm */
.card-anchor {
    position: absolute;
    left: 50%;
    top: 50%;
    transform-style: preserve-3d;
    will-change: transform;
    pointer-events: none;
    /* chỉ phần .product-box mới nhận click */
}

/* Thân card (relative) */
.card-anchor .product-box {
    position: relative;
    width: clamp(210px, 15vw, 280px);
    border-radius: 16px;
    background: #ffe5ea;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    text-align: center;
    user-select: none;
    transition: transform .6s cubic-bezier(.4, 0, .2, 1), opacity .3s, box-shadow .3s, filter .3s;
    will-change: transform, opacity, filter;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .2);
    pointer-events: auto;
}

.card-anchor .product-box:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
}

/* Ảnh & nội dung */
.product-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
    transition: transform .4s;
}

.product-box:hover img {
    transform: scale(.96);
}

.product-box .details .name {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: #c1121f;
}

.product-box .button {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.product-box .scom-detail-link {
    cursor: pointer;
    color: #8b0000;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    transition: color .2s;
}

.product-box .scom-detail-link:hover {
    text-decoration: underline;
}

/* ---------- Modal ---------- */
.scom-modal {
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(169, 68, 66, .08);
    transition: opacity .2s, visibility .2s;
    z-index: 9999;
}

#scom-modal-dynamic-content {
    white-space: pre-line;
    line-height: 1.2;
    text-align: left;
    overflow-wrap: break-word;
}

.scom-modal-content {
    background: #f5f5f5;
    color: #222;
    border: 3px solid #e0e0e0;
    border-radius: 30px;
    padding: 36px;
    margin: auto;
    max-width: 700px;
    min-width: 420px;
    min-height: 180px;
    font-size: 1.12rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .12);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.scom-modal-content strong,
.scom-modal-content b {
    color: #c1121f;
}

.scom-modal-content :is(h1, h2, h3, h4, h5, h6) {
    color: #c1121f;
    margin: .5em 0 .25em;
}

.scom-close {
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 32px;
    color: #757575;
    cursor: pointer;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .scom-title-buttons {
        grid-template-columns: repeat(5, minmax(120px, 1fr));
    }
}

@media (max-width: 768px) {
    .card-anchor .product-box {
        width: clamp(160px, 38vw, 210px);
    }

    .product-box img {
        border-radius: 12px;
    }

    .scom-title-buttons {
        grid-template-columns: repeat(4, minmax(120px, 1fr));
        gap: 8px;
    }
}

@media (max-width: 550px) {
    .scom-carousel-main {
        flex: 7.5;
    }

    .scom-carousel-buttons {
        flex: 2.5;
    }

    .card-anchor .product-box {
        width: clamp(120px, 56vw, 170px);
    }

    .product-box img {
        border-radius: 10px;
    }

    .scom-title-buttons {
        grid-template-columns: repeat(2, minmax(44vw, 1fr));
        gap: 8px;
    }
}