/* =============================================================
   responsive.css — TrenD Me
   Tất cả media query được tách ra khỏi style.css
   ============================================================= */

/* =========================================================
   DESKTOP  ≥ 768px  (prizes 2-col, hero 2-column grid)
   ========================================================= */
@media (min-width: 768px) {
    .hero__inner {
        grid-template-columns: 1fr 0.75fr;
    }

    .prizes__grid {
        grid-template-columns: 1fr 1fr;
        gap: 1.25rem;
    }
}

/* =========================================================
   DESKTOP  ≥ 900px  (slots 3-col, step2 side-by-side)
   ========================================================= */
@media (min-width: 900px) {
    .slots {
        grid-template-columns: repeat(3, 1fr);
    }

    .step2__layout {
        flex-wrap: nowrap;
        justify-content: center;
        gap: 1.5rem;
    }

    .step2__canvas-wrap {
        flex: 6 1 0;
    }

    .step2__cta {
        flex: 4 1 0;
    }

    .hashtag-bar__suffix {
        display: block;
    }
}

/* =========================================================
   LARGE DESKTOP  ≥ 1200px  (Full HD, màn hình văn phòng)
   ========================================================= */
@media (min-width: 1200px) {
    .hero__desc {
        font-size: clamp(1rem, 1vw, 1.15rem);
    }

    .hero__badge {
        font-size: clamp(0.9rem, 0.95vw, 1rem);
        padding: 0.55rem 0.75rem;
    }

    .section-title {
        font-size: clamp(1.4rem, 1.8vw, 1.8rem);
    }

    .step-title {
        font-size: clamp(1.2rem, 1.6vw, 1.6rem);
    }

    .step-num {
        width: clamp(3rem, 3.5vw, 3.75rem);
        height: clamp(3rem, 3.5vw, 3.75rem);
        font-size: clamp(1.5rem, 2vw, 2rem);
    }

    /* Zoom controls + slot name */
    .slot__zoom-label {
        font-size: clamp(0.9rem, 1vw, 1.1rem);
    }

    .slot__zoom-row button {
        font-size: clamp(1.2rem, 1.4vw, 1.5rem);
        min-width: 1.5rem;
    }

    .slot__name {
        font-size: clamp(1.1rem, 1.3vw, 1.4rem);
        font-weight: 700;
    }

}

/* =========================================================
   XLARGE DESKTOP  ≥ 1600px  (2K thật sự, màn hình cực lớn)
   ========================================================= */
@media (min-width: 1600px) {
    .hero {
        width: 67%;
    }

    .hero__necklace {
        height: clamp(220px, 18vw, 260px);
    }

    .hero__desc {
        font-size: clamp(1.1rem, 1.15vw, 1.35rem);
    }

    .hero__badge {
        font-size: clamp(1.05rem, 1.1vw, 1.25rem);
        padding: 0.65rem 1rem;
    }

    .section-title {
        font-size: clamp(1.8rem, 2.2vw, 2.6rem);
    }

    .step-title {
        font-size: clamp(1.5rem, 1.8vw, 2rem);
    }

    .hashtag-bar {
        font-size: clamp(0.85rem, 1.1vw, 1.15rem);
    }

    .hashtag-chip {
        font-size: clamp(1rem, 1.3vw, 1.3rem);
        padding: 0.3rem 1rem;
    }

    .hashtag-chip__icon {
        width: 15px;
        height: 15px;
    }
}

/* =========================================================
   FALLBACK  ≤ 899px  (step2 column, slots 1-col)
   ========================================================= */
@media (max-width: 899px) {
    .step2__layout {
        flex-direction: column;
    }

    .slots {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   MOBILE  ≤ 768px
   ========================================================= */
@media (max-width: 768px) {

    /* Background riêng cho mobile */
    body {
        background-image: url("../images/converted/background-mobile-2.webp");
        background-size: 100% auto;
        /* full width, height tỉ lệ theo ảnh */
        background-repeat: no-repeat;
        /* ảnh đủ cao → không cần tile */
        background-position: top center;
        background-attachment: scroll;
    }

    /* --- Hero: full-bleed --- */
    .hero {
        width: 100%;
        /* margin: 0 0 2rem; */
        margin-bottom: 0;
    }

    /* hero__inner: flex column, làm positioning context cho necklace */
    .hero__inner {
        position: relative;
        display: flex;
        flex-direction: column;
        gap: 0;
        grid-template-columns: unset;
    }

    /* 1️⃣ Logo TrenD clone — hiện trên cùng */
    .hero__branding-img--mobile {
        display: block;
        order: 0;
        /* width: clamp(160px, 55vw, 260px); */
        width: 75%;
        margin: 1.25rem auto 0;
    }

    /* 2️⃣ Banner model — full-width, không bo góc */
    .hero__visual {
        order: 1;
        padding-top: 0;
        width: 100%;
    }

    /* Ẩn banner gốc trên mobile */
    .hero__banner {
        display: none;
    }

    /* Banner mobile clone */
    .hero__banner--mobile {
        display: block;
        width: 90%;
        margin: 0 auto;
        max-height: none;
        border-radius: 0;
    }

    /* Necklace mobile clone — absolute trong hero__visual (position:relative sẵn có) */
    .hero__necklace--mobile {
        display: block;
        position: absolute;
        right: 0;
        top: 0;
        right: 1.5rem;
        height: clamp(130px, 22vw, 180px);
        width: auto;
        z-index: 5;
        pointer-events: none;
    }

    /* Ẩn necklace gốc (dùng clone --mobile thay thế) */
    .hero__necklace {
        display: none;
    }

    /* 3️⃣ Text mô tả — bên dưới banner */
    .hero__content {
        order: 2;
        position: static;
        display: block;
        padding: 0 1rem;
        text-align: center;
        grid-template-columns: unset;
    }

    /* Ẩn logo gốc bên trong hero__body (dùng clone --mobile thay thế) */
    .hero__branding {
        display: none;
    }

    .hero__desc {
        text-align: justify;
        font-size: clamp(0.7rem, 3vw, 0.8rem);
        margin-bottom: .75rem;
    }

    .hero__badge {
        margin: 0 auto;
        display: none;
    }

    .hero__desc--last {
        margin-bottom: 0;
    }

    /* --- Page container --- */
    .page {
        width: 85%;
        padding: 0 0 1.5rem;
    }

    /* Breakout: cho .step-panel--preview thoát khỏi .page để canvas rộng hơn */
    .step-panel--preview {
        width: 95vw;
        margin-left: calc(50% - 47.5vw);
        box-sizing: border-box;
    }

    /* Thu nhỏ spacing các section/block trên mobile */
    .section {
        margin-bottom: 1.5rem;
    }

    .section-title {
        font-size: clamp(1.2rem, 5.5vw, 1.5rem);
        margin: 0 0 1rem;
    }

    /* Step header: badge số + tiêu đề */
    .step-header {
        gap: 0.5rem;
        /* giảm khoảng cách badge ↔ title */
        margin: 0 0 1rem;
    }

    .step-num {
        width: 2rem;
        height: 2rem;
        font-size: 1rem;
        /* badge số nhỏ hơn */
    }

    .step-title {
        font-size: clamp(1.1rem, 4.5vw, 1.35rem);
        /* tiêu đề nhỏ hơn */
    }

    /* --- Step 1: 3 cột compact --- */
    .slots {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
        padding: 1rem;
    }

    .step-panel--styles {
        background-image: url("../images/converted/background-cta-group.webp");
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        padding: 0.75rem 0.6rem 1rem;
        overflow: hidden;
    }

    .slot {
        background: none;
        border-radius: 0;
        padding: 0.15rem 0.1rem;
        /* 2. thêm padding */
        gap: 0.2rem;
        min-width: 0;
    }

    /* Khung vuông — width:100% + aspect-ratio:1/1 (base) = vuông theo cột */
    .slot__frame {
        width: 100%;
        border-radius: 5px;
        /* 1. giảm border-radius */
        border-width: 2px;
    }

    .slot__indicator {
        width: 0.85rem;
        height: 0.85rem;
        top: 0.25rem;
        right: 0.25rem;
        font-size: 0.5rem;
    }

    /* Upload icon */
    .slot__upload-icon {
        width: 1.6rem;
        height: 1.6rem;
        margin: 0.25rem auto 0;
    }

    .slot__upload-icon img {
        width: 1.6rem;
        height: 1.6rem;
    }

    /* Zoom controls: tăng touch target cho mobile */
    .slot__zoom {
        margin: 0.2rem auto 0;
        gap: 0.15rem;
        font-size: 0.6rem;
        width: 100%;
    }

    .slot__zoom-label {
        font-size: 0.56rem;
        letter-spacing: 0;
    }

    .slot__zoom-row {
        gap: 0.3rem;
    }

    .slot__zoom-row button {
        width: 1.6rem;
        height: 1.6rem;
        font-size: 1rem;
        min-width: 1.6rem;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }

    .slot__zoom input[type="range"] {
        height: 1.9rem;
        padding: 0.25rem 0;
    }

    .slot__zoom input[type="range"]::-webkit-slider-runnable-track {
        height: 6px;
    }

    .slot__zoom input[type="range"]::-webkit-slider-thumb {
        width: 16px;
        height: 16px;
        margin-top: -5px;
    }

    .slot__zoom input[type="range"]::-moz-range-track {
        height: 6px;
    }

    .slot__zoom input[type="range"]::-moz-range-progress {
        height: 6px;
    }

    .slot__zoom input[type="range"]::-moz-range-thumb {
        width: 16px;
        height: 16px;
    }

    .slot__name {
        /* margin-top: 0.5rem; */
        /* 4. khoảng cách zoom → title */
    }

    /* --- Step panel (base): giảm padding cho mobile --- */
    .step-panel {
        padding: 0;
        border-radius: var(--radius-sm, 12px);
    }

    /* --- Step 2: canvas trên, CTA dưới --- */
    .step2__layout {
        flex-direction: column;
        gap: 1rem;
    }

    .step2__canvas-wrap {
        flex: unset;
        width: 100%;
    }

    .step2__cta {
        flex: unset;
        width: 85vw;
        margin: 0 auto;
        border-radius: 16px;
    }

    .step2__cta .btn {
        padding: .5rem .75rem;
    }

    /* --- Register --- */
    .register__panel {
        padding: 1.25rem 1rem;
        border-radius: 16px;
    }

    .register__title {
        font-size: clamp(1rem, 4.5vw, 1.25rem);
        margin: 0 0 1rem;
    }

    .register__fields {
        width: 100%;
    }

    .field {
        margin-bottom: 0.75rem;
    }

    .field input {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .consent {
        max-width: 100%;
        font-size: 0.8rem;
        margin: 1rem auto 0;
    }

    [data-error-for="consent"] {
        max-width: 100%;
    }

    .register__panel .btn--gold {
        padding: 0.75rem 1rem 0.5rem;
        margin: 1.25rem auto 0;
    }

    /* --- Prizes --- */
    .prizes {
        margin-top: 1.25rem;
    }

    .prizes__grid {
        padding: 0 1rem;
    }

    .prizes__card {
        border-radius: 16px;
    }

    .btn {
        border-radius: 12px;
    }
}

/* =========================================================
   TABLET  769px – 1024px
   ========================================================= */
@media (min-width: 769px) and (max-width: 1024px) {
    .hero {
        width: 90%;
    }

    .page {
        width: 85%;
    }

    .slots {
        grid-template-columns: repeat(2, 1fr);
    }

    .step2__layout {
        flex-direction: column;
    }

    .step2__canvas-wrap {
        flex: unset;
        width: 100%;
    }

    .step2__cta {
        flex: unset;
        width: 85vw;
    }
}

/* =========================================================
   LARGE MOBILE  540px – 768px
   (giữ layout mobile, scale up font size cho màn lớn hơn)
   ========================================================= */
@media (min-width: 540px) and (max-width: 768px) {
    .page {
        width: 85%;
    }

    .hero__content {
        padding: 0 4rem;
    }

    .hero__branding-img--mobile {
        margin-top: 2.5rem;
    }

    .hero__desc {
        font-size: clamp(1rem, 2.2vw, 1.15rem);
    }

    .section {
        margin-bottom: 3rem;
    }

    .section-title {
        font-size: clamp(2rem, 4vw, 2.5rem);
        margin-bottom: 2rem;
    }

    .step-num {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.25rem;
    }

    .step-title {
        font-size: clamp(1.4rem, 2.8vw, 1.7rem);
    }

    .step-header {
        gap: 0.75rem;
        margin: 0 0 2rem;
    }

    /* Slot elements scale up */
    .slot {
        gap: 0.4rem;
        /* tăng khoảng cách giữa các phần tử trong slot */
    }

    .slot__upload-icon,
    .slot__upload-icon img {
        width: 2.25rem;
        height: 2.25rem;
    }

    .slot__upload-icon {
        margin-top: 0.5rem;
        /* tăng khoảng cách khung → upload */
    }

    .slot__indicator {
        width: 1.1rem;
        height: 1.1rem;
        font-size: 0.7rem;
    }

    .slot__zoom {
        font-size: 0.78rem;
        margin-top: 0.4rem;
        gap: 0.25rem;
    }

    .slot__zoom-label {
        font-size: 0.78rem;
    }

    .slot__zoom-row button {
        width: 1.9rem;
        height: 1.9rem;
        font-size: 1.15rem;
        min-width: 1.9rem;
    }

    .slot__name {
        /* margin-top: 0.4rem; */
        /* tăng khoảng cách zoom → label */
    }

    /* Register section */
    .register__title {
        font-size: clamp(1.2rem, 2.8vw, 1.5rem);
    }

    .field input {
        font-size: 1rem;
        padding: 0.9rem 1.25rem;
    }

    .consent {
        font-size: 0.875rem;
    }

    .register__panel .btn--gold {
        font-size: 1.15rem;
        padding: 0.9rem 1.25rem .7rem;
    }

    /* Step 2 CTA */
    .step2__cta {
        font-size: 1rem;
    }

    /* prizes__grid: mỗi ảnh 1 dòng riêng trên iPad Mini */
    .prizes__grid {
        padding: 0 5rem;
        gap: .5rem;
        grid-template-columns: 1fr;
    }


    .slot__zoom input[type="range"] {
        height: 2rem;
        padding: 0.2rem 0;
    }

    .slot__zoom input[type="range"]::-webkit-slider-runnable-track {
        height: 7px;
    }

    .slot__zoom input[type="range"]::-webkit-slider-thumb {
        width: 18px;
        height: 18px;
        margin-top: -5.5px;
    }

    .slot__zoom input[type="range"]::-moz-range-track {
        height: 7px;
    }

    .slot__zoom input[type="range"]::-moz-range-progress {
        height: 7px;
    }

    .slot__zoom input[type="range"]::-moz-range-thumb {
        width: 18px;
        height: 18px;
    }

    .step2__cta {
        width: 85vw;
        margin-top: 1rem;
    }
}

/* =========================================================
   SMALL MOBILE  ≤ 539px
   (điện thoại Android phổ thông, iPhone 14/13/12 standard)
   ========================================================= */
@media (max-width: 539px) {

    /* Hero */
    .hero__branding-img--mobile {
        margin-top: 1rem;
    }

    .hero__necklace--mobile {
        height: clamp(110px, 20vw, 180px);
        /* right: 8px; */
    }

    /* iPhone XR / 12 mini / màn ≥ 390px — tăng necklace */
    @media (min-width: 390px) {
        .hero__necklace--mobile {
            height: clamp(130px, 28vw, 200px);
        }
    }

    .hero__content {
        padding: 0 2rem;
    }

    .hero__desc {
        font-size: clamp(0.82rem, 3.5vw, 0.95rem);
    }

    /* Page */
    .page {
        width: 85%;
        padding: 0 0 1rem;
    }

    /* Section titles */
    .section-title {
        font-size: clamp(1.6rem, 7vw, 2rem);
    }

    /* Step header */
    .step-num {
        width: 2rem;
        height: 2rem;
        font-size: 1rem;
    }

    .step-title {
        font-size: clamp(0.85rem, 3.5vw, 1rem);
    }

    /* Slots: 3 hàng riêng biệt, mỗi slot có background riêng */
    .step-panel--styles {
        background: none;
        padding: 0;
        overflow: visible;
    }

    .slots {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0;
        background: none;
    }

    .slot {
        gap: 0.5rem;
        background-image: url("../images/converted/background-style.webp");
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        border-radius: 16px;
        padding: 1.25rem 1.25rem 1rem;
        overflow: hidden;
    }

    .slot__frame {
        border-radius: 16px;
        border-width: 2px;
        aspect-ratio: 1 / 1;
    }

    .slot__indicator {
        width: 1rem;
        height: 1rem;
        top: 0.5rem;
        right: 0.5rem;
        font-size: 0.6rem;
    }

    .slot__upload-icon,
    .slot__upload-icon img {
        width: 3.5rem;
        height: 3.5rem;
    }

    .slot__upload-icon {
        margin-top: 0.5rem;
    }

    /* Zoom: layout đơn giản — zoom-row và slider cùng width 100% → tự thẳng hàng */
    .slot__zoom {
        display: block;
        margin-top: 0.55rem;
    }

    .slot__zoom-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 0;
    }

    .slot__zoom-row [data-zoom-out],
    .slot__zoom-row [data-zoom-in] {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 1.35rem;
        min-width: 2.25rem;
        flex-shrink: 0;
    }

    .slot__zoom-label {
        flex: 1;
        font-size: 0.95rem;
        letter-spacing: 0;
        text-align: center;
    }

    /* Slider width:100% = cùng rộng với zoom-row → thẳng dọ */
    .slot__zoom input[type="range"] {
        width: 100%;
        height: 2.1rem;
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    .slot__zoom input[type="range"]::-webkit-slider-runnable-track {
        height: 7px;
    }

    .slot__zoom input[type="range"]::-webkit-slider-thumb {
        width: 20px;
        height: 20px;
        margin-top: -6.5px;
    }

    .slot__zoom input[type="range"]::-moz-range-track {
        height: 7px;
    }

    .slot__zoom input[type="range"]::-moz-range-progress {
        height: 7px;
    }

    .slot__zoom input[type="range"]::-moz-range-thumb {
        width: 20px;
        height: 20px;
    }

    .slot__name {
        font-size: 1.25rem;
        font-weight: 700;
        /* margin-top: 0.3rem; */
    }

    /* Step 2 CTA: mở rộng để dễ tap */
    .step2__cta {
        width: 85vw;
        padding: 1.5rem;
        gap: .8rem;
    }

    .hashtag-bar {
        font-size: clamp(0.7rem, 2.8vw, 0.9rem);
    }

    .step2__cta .btn {
        padding: 0.5rem 0.75rem;
        font-size: 1rem;
    }

    /* Register */
    .register__panel {
        padding: 1rem 0.75rem;
    }

    .register__title {
        font-size: clamp(0.95rem, 4vw, 1.15rem);
        margin-bottom: 0.75rem;
    }

    .register__fields {
        width: 100%;
    }

    .field input {
        padding: 0.65rem 0.85rem;
        font-size: 0.875rem;
    }

    .consent {
        font-size: 0.75rem;
        margin-top: 0.75rem;
    }

    .register__panel .btn--gold {
        padding: 0.7rem 0.85rem .5rem;
        margin-top: 1rem;
    }

    /* Prizes */
    .prizes__grid {
        padding: 0 0.5rem;
        gap: 0.5rem;
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   VERY SMALL MOBILE  ≤ 375px
   (iPhone SE gen 3, Galaxy A03, màn hình cực nhỏ)
   ========================================================= */
@media (max-width: 375px) {

    /* Hero */
    .hero__branding-img--mobile {
        margin-top: 0.75rem;
    }

    .hero__necklace--mobile {
        /* height: clamp(85px, 18vw, 110px); */
        /* right: 4px; */
    }

    .hero__content {
        padding: 0 1rem;
    }

    .hero__desc {
        font-size: clamp(0.82rem, 3.5vw, 0.95rem);
        line-height: 1.6;
    }

    /* Slots: layout mới — 1 cột / 3 hàng riêng biệt (đồng bộ với ≤539px) */
    .step-panel--styles {
        background: none;
        padding: 0;
        overflow: visible;
    }

    .slots {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 0;
        background: none;
    }

    .slot {
        gap: 0.5rem;
        background-image: url("../images/converted/background-style.webp");
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        border-radius: 14px;
        padding: 1rem;
        overflow: hidden;
    }

    /* Xoá rule căn giữa slot thứ 3 cũ */
    .slot:last-child {
        grid-column: unset;
        width: unset;
        margin: 0;
    }

    .slot__frame {
        border-radius: 14px;
        aspect-ratio: 1 / 1;
    }

    .slot__indicator {
        width: 0.9rem;
        height: 0.9rem;
        top: 0.4rem;
        right: 0.4rem;
        font-size: 0.5rem;
    }

    .slot__upload-icon,
    .slot__upload-icon img {
        width: 3rem;
        height: 3rem;
    }

    .slot__zoom {
        display: block;
        margin-top: 0.45rem;
    }

    .slot__zoom-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 0;
    }

    .slot__zoom-row [data-zoom-out],
    .slot__zoom-row [data-zoom-in] {
        width: 2rem;
        height: 2rem;
        font-size: 1.2rem;
        min-width: 2rem;
    }

    .slot__zoom-label {
        flex: 1;
        font-size: 0.9rem;
        text-align: center;
    }

    .slot__zoom input[type="range"] {
        width: 100%;
        height: 2rem;
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    .slot__zoom input[type="range"]::-webkit-slider-runnable-track {
        height: 6px;
    }

    .slot__zoom input[type="range"]::-webkit-slider-thumb {
        width: 18px;
        height: 18px;
        margin-top: -6px;
    }

    .slot__zoom input[type="range"]::-moz-range-track {
        height: 6px;
    }

    .slot__zoom input[type="range"]::-moz-range-progress {
        height: 6px;
    }

    .slot__zoom input[type="range"]::-moz-range-thumb {
        width: 18px;
        height: 18px;
    }

    /* Step headers */
    .step-num {
        width: 2rem;
        height: 2rem;
        font-size: 1rem;
    }

    .step-title {
        font-size: clamp(0.85rem, 3.8vw, 1rem);
    }

    /* Step 2 CTA */
    .step2__cta {
        width: 85vw;
        padding: 0.75rem 0.5rem;
    }

    .hashtag-bar {
        font-size: clamp(0.75rem, 3.5vw, 0.875rem);
    }

    /* Register */
    .register__title {
        font-size: clamp(1rem, 4.5vw, 1.25rem);
    }

    .field input {
        padding: 0.65rem 0.85rem;
        font-size: 0.875rem;
    }

    .consent {
        font-size: 0.75rem;
        gap: 0.4rem;
    }

    .register__panel .btn--gold {
        letter-spacing: 1px;
    }

    /* Section title */
    .section-title {
        font-size: clamp(1.2rem, 5.5vw, 1.5rem);
    }
}
