/* ─── Handy Trade Popup — Frontend Styles ──────────────────────────────────── */

:root {
    --htp-green:      #007A53;
    --htp-green-dark: #005A3D;
    --htp-white:      #ffffff;
    --htp-grey-50:    #f8fafc;
    --htp-grey-200:   #e2e8f0;
    --htp-grey-500:   #64748b;
    --htp-grey-900:   #0f172a;
    --htp-radius:     16px;
    --htp-shadow:     0 25px 60px rgba(0, 0, 0, .35);
    --htp-transition: .3s cubic-bezier(.4, 0, .2, 1);
}

/* ── Overlay ──────────────────────────────────────────────────────────────── */
.htp-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, .45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    /* animation states */
    opacity: 0;
    transition: opacity var(--htp-transition);
}
.htp-overlay[hidden] {
    /* keep using hidden attr — JS removes it then sets opacity */
    display: none !important;
}
.htp-overlay.htp-visible { opacity: 1; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.htp-modal {
    position: relative;
    width: 100%;
    max-width: 860px;
    max-height: 90vh;
    display: flex;
    flex-direction: row;
    background: var(--htp-white);
    border-radius: var(--htp-radius);
    overflow: hidden;
    box-shadow: var(--htp-shadow);
    transform: scale(.92) translateY(24px);
    transition: transform var(--htp-transition);
}
.htp-overlay.htp-visible .htp-modal {
    transform: scale(1) translateY(0);
}

/* ── Panels ───────────────────────────────────────────────────────────────── */
.htp-panel { display: flex; flex-direction: column; }

/* Image panel */
.htp-panel--image {
    position: relative;
    width: 42%;
    flex-shrink: 0;
    background: var(--htp-grey-200);
    overflow: hidden;
}
.htp-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}
.htp-img-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, transparent 60%, rgba(255,255,255,.08));
    pointer-events: none;
}

/* Content panel */
.htp-panel--content {
    flex: 1;
    padding: 40px 36px;
    justify-content: center;
    overflow-y: auto;
}
.htp-panel--full { width: 100%; max-width: 560px; margin: auto; }

/* ── Close button ─────────────────────────────────────────────────────────── */
.htp-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 10;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .9);
    border: 1px solid var(--htp-grey-200);
    border-radius: 50%;
    cursor: pointer;
    color: var(--htp-grey-500);
    backdrop-filter: blur(4px);
    transition: background .15s, color .15s, transform .1s;
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.htp-close:hover { background: #fff; color: var(--htp-grey-900); transform: scale(1.1); }
.htp-close:active { transform: scale(.95); }

/* ── Badge ────────────────────────────────────────────────────────────────── */
.htp-badge {
    display: inline-block;
    background: var(--htp-green);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 999px;
    margin-bottom: 14px;
}

/* ── Heading ──────────────────────────────────────────────────────────────── */
.htp-heading {
    margin: 0 0 14px;
    font-size: clamp(22px, 3vw, 32px);
    font-weight: 800;
    line-height: 1.2;
    color: var(--htp-grey-900);
    letter-spacing: -.5px;
}

/* ── Description ──────────────────────────────────────────────────────────── */
.htp-desc {
    margin: 0 0 24px;
    font-size: 15px;
    line-height: 1.65;
    color: var(--htp-grey-500);
}

/* ── CTA Button ───────────────────────────────────────────────────────────── */
.htp-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--htp-green);
    color: #fff !important;
    text-decoration: none !important;
    font-size: 15px;
    font-weight: 700;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: background .2s, box-shadow .2s, transform .1s;
    box-shadow: 0 4px 16px rgba(0, 122, 83, .28);
    align-self: flex-start;
}
.htp-cta:hover {
    background: var(--htp-green-dark) !important;
    box-shadow: 0 6px 20px rgba(0, 122, 83, .38);
    color: #fff !important;
}
.htp-cta:active { transform: scale(.97); }
.htp-cta-icon {
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity .2s, transform .2s;
    flex-shrink: 0;
}
.htp-cta:hover .htp-cta-icon { opacity: 1; transform: translateX(0); }

/* ── Terms ────────────────────────────────────────────────────────────────── */
.htp-terms {
    margin: 14px 0 0;
    font-size: 12px;
    color: var(--htp-grey-500);
    opacity: .75;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 680px) {
    .htp-modal { flex-direction: column; max-height: 92vh; }

    .htp-panel--image {
        width: 100%;
        height: 200px;
        flex-shrink: 0;
    }

    .htp-panel--content { padding: 28px 24px; }

    .htp-heading { font-size: 22px; }

    .htp-close { top: 10px; right: 10px; }
}

@media (max-width: 380px) {
    .htp-panel--content { padding: 22px 18px; }
    .htp-cta { width: 100%; justify-content: center; }
}

/* ── Respect user motion preference ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .htp-overlay,
    .htp-modal,
    .htp-close,
    .htp-cta,
    .htp-cta-icon { transition: none; }
}
