/* =========================================================================
   Mamoki Videos — Front-end styles (v2: pretty edition)
   Sử dụng --primary-color của Flatsome để dễ đổi màu chủ đạo.
   ========================================================================== */

.mamoki-videos-wrap,
.mamoki-videos-section {
    --mvc-primary: var(--primary-color, #b9412c);
    /* Tạo các sắc thái phụ trợ từ primary qua color-mix.
       Browser cũ (không hỗ trợ color-mix) sẽ fallback các giá trị tĩnh dưới. */
    --mvc-primary-soft:    color-mix(in srgb, var(--mvc-primary) 35%, #fff);
    --mvc-primary-softer:  color-mix(in srgb, var(--mvc-primary) 22%, #fff);
    --mvc-primary-shadow:  color-mix(in srgb, var(--mvc-primary) 40%, transparent);
    --mvc-primary-shadow2: color-mix(in srgb, var(--mvc-primary) 55%, transparent);
}

.mamoki-videos-wrap { width: 100%; }

/* Fallback cho trình duyệt không hỗ trợ color-mix */
@supports not (background: color-mix(in srgb, red, blue)) {
    .mamoki-videos-wrap,
    .mamoki-videos-section {
        --mvc-primary-soft:    #d6a99a;
        --mvc-primary-softer:  #e2c4bb;
        --mvc-primary-shadow:  rgba(185, 65, 44, .35);
        --mvc-primary-shadow2: rgba(185, 65, 44, .55);
    }
}

/* ---------- Section ---------- */
.mamoki-videos-section {
    width: 100%;
    margin: 0 auto 60px;
    box-sizing: border-box;
}
.mamoki-videos-section + .mamoki-videos-section { margin-top: 10px; }

/* ---------- Heading: hai đường ngang + chữ giữa ---------- */
.mamoki-videos-heading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin: 0 0 28px;
    text-align: center;
    color: var(--mvc-primary);
    font-weight: 700;
    letter-spacing: .25em;
    font-size: 1.05rem;
    line-height: 1.2;
}
.mamoki-videos-heading::before,
.mamoki-videos-heading::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--mvc-primary-soft) 20%, var(--mvc-primary-soft) 80%, transparent);
    max-width: 220px;
}
.mamoki-videos-heading > span {
    white-space: nowrap;
    padding: 0 4px;
    background: transparent;
}

@media (max-width: 549px) {
    .mamoki-videos-heading { font-size: .95rem; letter-spacing: .2em; }
    .mamoki-videos-heading::before,
    .mamoki-videos-heading::after { max-width: 90px; }
}

/* ---------- Grid ---------- */
.mamoki-videos-grid {
    display: grid;
    gap: 22px;
    align-items: start;
}
.mamoki-videos-grid.mamoki-grid-1 { grid-template-columns: 1fr; }
.mamoki-videos-grid.mamoki-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mamoki-videos-grid.mamoki-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mamoki-videos-grid.mamoki-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Section Short giữ chung kích thước với section khác */
.mamoki-videos-section[data-type="short"] .mamoki-videos-grid {
    gap: 22px;
}

@media (max-width: 849px) {
    .mamoki-videos-grid.mamoki-grid-3,
    .mamoki-videos-grid.mamoki-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
}
@media (max-width: 549px) {
    .mamoki-videos-grid.mamoki-grid-2,
    .mamoki-videos-grid.mamoki-grid-3,
    .mamoki-videos-grid.mamoki-grid-4 { grid-template-columns: 1fr; max-width: 360px; margin: 0 auto; }
}

/* ---------- Card ---------- */
.mamoki-video-card {
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    transition: transform .35s ease;
}
.mamoki-video-card:hover { transform: translateY(-3px); }

/* ---------- Thumbnail box ---------- */
.mamoki-video-thumb {
    position: relative;
    width: 100%;
    overflow: hidden;
    cursor: pointer;
    background: #1a1a1a;
    border-radius: 14px;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, .08),
        0 8px 24px -10px rgba(0, 0, 0, .25);
    transition: box-shadow .35s ease, transform .35s ease;
    isolation: isolate;
}
.mamoki-video-thumb:hover {
    box-shadow:
        0 2px 4px rgba(0, 0, 0, .1),
        0 16px 36px -10px var(--mvc-primary-shadow);
}

/* Tỉ lệ */
.mamoki-video-card.is-regular .mamoki-video-thumb { aspect-ratio: 16 / 9 !important; }
.mamoki-video-card.is-short   .mamoki-video-thumb { aspect-ratio: 9 / 16 !important; }

@supports not (aspect-ratio: 1) {
    .mamoki-video-card.is-regular .mamoki-video-thumb::before { content: ""; display: block; padding-top: 56.25%; }
    .mamoki-video-card.is-short   .mamoki-video-thumb::before { content: ""; display: block; padding-top: 177.78%; }
}

.mamoki-video-thumb img,
.mamoki-video-thumb iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    object-fit: cover;
    display: block;
    transition: transform .6s cubic-bezier(.2, .7, .2, 1), filter .35s ease;
}
.mamoki-video-thumb:hover img {
    transform: scale(1.06);
    filter: brightness(.92) saturate(1.08);
}

.mamoki-video-thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, .35) 100%);
    opacity: 0;
    transition: opacity .35s ease;
    pointer-events: none;
    z-index: 1;
}
.mamoki-video-thumb:hover::after { opacity: 1; }

/* ---------- Play button (giữ màu YouTube đỏ chuẩn nhận diện) ---------- */
.mamoki-video-play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 72px;
    height: 50px;
    border-radius: 14px;
    background: linear-gradient(180deg, #ff1f1f 0%, #c80000 100%);
    box-shadow:
        0 6px 18px rgba(255, 0, 0, .35),
        0 1px 0 rgba(255, 255, 255, .25) inset,
        0 -6px 12px rgba(0, 0, 0, .2) inset;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 2;
    transition: transform .3s ease, box-shadow .3s ease;
}
.mamoki-video-play::before {
    content: "";
    width: 0; height: 0;
    border-style: solid;
    border-width: 11px 0 11px 18px;
    border-color: transparent transparent transparent #fff;
    margin-left: 4px;
    filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .15));
}
.mamoki-video-thumb:hover .mamoki-video-play {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow:
        0 10px 28px rgba(255, 0, 0, .55),
        0 1px 0 rgba(255, 255, 255, .3) inset,
        0 -6px 12px rgba(0, 0, 0, .2) inset;
}

.mamoki-video-play::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 18px;
    border: 2px solid rgba(255, 31, 31, .5);
    animation: mamoki-pulse 2.2s ease-out infinite;
    pointer-events: none;
}
@keyframes mamoki-pulse {
    0%   { transform: scale(.95); opacity: .8; }
    70%  { transform: scale(1.25); opacity: 0; }
    100% { transform: scale(1.25); opacity: 0; }
}

.mamoki-video-thumb.is-playing img,
.mamoki-video-thumb.is-playing .mamoki-video-play,
.mamoki-video-thumb.is-playing::after { display: none; }

/* ---------- Title ---------- */
.mamoki-video-title {
    font-size: .98rem;
    line-height: 1.45;
    margin: 14px 6px 0;
    text-align: left;
    color: #2a2a2a;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color .25s ease;
}
.mamoki-video-card:hover .mamoki-video-title { color: var(--mvc-primary); }

/* ---------- Load more ---------- */
.mamoki-videos-actions {
    text-align: center;
    margin-top: 26px;
}
.mamoki-videos-load-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 28px;
    background: var(--mvc-primary);
    color: #fff !important;
    border: 0;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .14em;
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow:
        0 4px 14px var(--mvc-primary-shadow),
        0 1px 0 rgba(255, 255, 255, .25) inset;
    transition: transform .25s ease, box-shadow .25s ease, filter .25s ease;
}
.mamoki-videos-load-more:hover:not(:disabled) {
    filter: brightness(.92);
    transform: translateY(-1px);
    box-shadow:
        0 8px 22px var(--mvc-primary-shadow2),
        0 1px 0 rgba(255, 255, 255, .25) inset;
}
.mamoki-videos-load-more:active:not(:disabled) { transform: translateY(0); }
.mamoki-videos-load-more:disabled { opacity: .65; cursor: progress; }
.mamoki-videos-load-more::after {
    content: "›";
    font-size: 1.2em;
    line-height: 1;
    margin-top: -2px;
    transition: transform .25s ease;
}
.mamoki-videos-load-more:hover:not(:disabled)::after { transform: translateX(3px); }

/* ---------- Animation card mới ---------- */
.mamoki-video-card.is-new { animation: mamoki-fade-up .5s ease both; }
@keyframes mamoki-fade-up {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =========================================================================
   Slider layout
   ========================================================================== */
.mamoki-videos-track-wrap { position: relative; }

.mamoki-videos-grid.is-slider {
    display: flex;
    flex-wrap: nowrap;
    gap: 18px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding: 4px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.mamoki-videos-grid.is-slider::-webkit-scrollbar { display: none; width: 0; height: 0; }

.mamoki-videos-grid.is-slider > .mamoki-video-card {
    flex: 0 0 calc((100% - var(--mvc-cols, 4) * 18px + 18px) / var(--mvc-cols, 4));
    scroll-snap-align: start;
    min-width: 0;
}

.mamoki-videos-track-wrap[style*="--mvc-cols:1"] .mamoki-videos-grid.is-slider > .mamoki-video-card {
    flex: 0 0 100%;
    max-width: 100%;
}
.mamoki-videos-track-wrap[style*="--mvc-cols:1"] .mamoki-video-card.is-short  .mamoki-video-thumb {
    max-width: 380px;
    margin: 0 auto;
}
.mamoki-videos-track-wrap[style*="--mvc-cols:1"] .mamoki-video-card.is-regular .mamoki-video-thumb {
    max-width: 760px;
    margin: 0 auto;
}

@media (max-width: 849px) {
    .mamoki-videos-grid.is-slider > .mamoki-video-card {
        flex-basis: calc((100% - 2 * 18px + 18px) / 2);
    }
}
@media (max-width: 549px) {
    .mamoki-videos-grid.is-slider > .mamoki-video-card {
        flex-basis: 78%;
    }
}

.is-slider-section .mamoki-videos-grid.is-slider { padding-bottom: 18px; }

/* =========================================================================
   Slider dots + counter
   ========================================================================== */
.mamoki-videos-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin: 18px 0 0;
    padding: 0;
    flex-wrap: wrap;
    vertical-align: middle;
}

.mamoki-videos-section .mamoki-videos-dots .mamoki-videos-dot,
button.mamoki-videos-dot {
    width: 8px !important;
    height: 8px !important;
    min-width: 8px !important;
    min-height: 8px !important;
    max-height: 8px !important;
    line-height: 8px !important;
    border-radius: 50% !important;
    border: 0 !important;
    background: var(--mvc-primary-softer) !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer;
    box-shadow: none !important;
    outline: none !important;
    transition: background .25s ease, width .25s ease;
    flex-shrink: 0;
    box-sizing: border-box !important;
    -webkit-tap-highlight-color: transparent;
}
.mamoki-videos-section .mamoki-videos-dots .mamoki-videos-dot:hover,
button.mamoki-videos-dot:hover,
.mamoki-videos-section .mamoki-videos-dots .mamoki-videos-dot:focus,
button.mamoki-videos-dot:focus,
.mamoki-videos-section .mamoki-videos-dots .mamoki-videos-dot:focus-visible,
button.mamoki-videos-dot:focus-visible {
    background: var(--mvc-primary-softer) !important;
    outline: none !important;
}

.mamoki-videos-section .mamoki-videos-dots .mamoki-videos-dot.is-active,
button.mamoki-videos-dot.is-active,
.mamoki-videos-section .mamoki-videos-dots .mamoki-videos-dot.is-active:hover,
button.mamoki-videos-dot.is-active:hover,
.mamoki-videos-section .mamoki-videos-dots .mamoki-videos-dot.is-active:focus,
button.mamoki-videos-dot.is-active:focus {
    background: var(--mvc-primary) !important;
    width: 22px !important;
    border-radius: 999px !important;
    outline: none !important;
}

.mamoki-videos-counter {
    display: inline-block;
    margin: 18px 0 0 12px;
    color: #999;
    font-size: .8rem;
    letter-spacing: .03em;
    font-weight: 500;
    vertical-align: middle;
    font-variant-numeric: tabular-nums;
}
.mamoki-videos-counter .mvc-current {
    color: var(--mvc-primary);
    font-weight: 700;
}

.mamoki-videos-section[data-layout="slider"] {
    text-align: center;
}
.mamoki-videos-section[data-layout="slider"] .mamoki-videos-track-wrap,
.mamoki-videos-section[data-layout="slider"] .mamoki-videos-heading {
    text-align: initial;
}
