/* ============================================================
   Reel Contest promo — floating icon + homepage popup
   Markup: resources/views/website/partials/contest-promo.blade.php
   Sits with the WhatsApp widget (whatsapp-widget.css):
     WhatsApp button z 99999 · WhatsApp chat 99998 · contest icon 99997 · popup 100000
   ============================================================ */

/* ---------- Floating contest icon (above the WhatsApp button) ---------- */
.ct-float {
    position: fixed;
    right: 30px;                 /* centred over the 60px WhatsApp button at right:28px */
    bottom: 102px;               /* 28px + 60px WhatsApp button + 14px gap */
    z-index: 99997;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    text-decoration: none;
    background: linear-gradient(135deg, #ff8a2a, #ff4d0d);
    box-shadow: 0 4px 16px rgba(255, 77, 13, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.25s ease, visibility 0.25s ease;
}

.ct-float:hover,
.ct-float:focus-visible {
    color: #ffffff;
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(255, 77, 13, 0.5);
}

.ct-float:focus-visible {
    outline: 3px solid #101828;
    outline-offset: 3px;
}

.ct-float svg {
    position: relative;
    z-index: 1;
    width: 27px;
    height: 27px;
}

/* Pulse ring, same rhythm as the WhatsApp button */
.ct-float::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: #ff6a1a;
    opacity: 0;
    animation: ctPulse 2s ease-out infinite;
}

@keyframes ctPulse {
    0% { transform: scale(1); opacity: 0.45; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* Hover label (desktop) */
.ct-float-label {
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translate(6px, -50%);
    white-space: nowrap;
    background: #101828;
    color: #ffffff;
    font: 600 13px/1 'Roboto', 'Segoe UI', sans-serif;
    padding: 8px 12px;
    border-radius: 999px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.ct-float:hover .ct-float-label,
.ct-float:focus-visible .ct-float-label {
    opacity: 1;
    transform: translate(0, -50%);
}

/* Step aside while the WhatsApp chat panel is open (it opens over this spot) */
#waWidgetBtn.wa-btn-open ~ .ct-float {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

@media (max-width: 480px) {
    .ct-float {
        width: 50px;
        height: 50px;
        right: 20px;             /* centred over the 54px button at right:18px */
        bottom: 84px;            /* 18px + 54px + 12px */
    }

    .ct-float svg {
        width: 24px;
        height: 24px;
    }
}

/* Mobile bottom tab bar lifts the WhatsApp button (mobile-bottom-nav.css); follow it */
@media (max-width: 767.98px) {
    body.has-mobile-bottom-nav .ct-float {
        bottom: calc(72px + 60px + 14px + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 480px) {
    body.has-mobile-bottom-nav .ct-float {
        bottom: calc(72px + 54px + 12px + env(safe-area-inset-bottom, 0px));
    }
}

/* ---------- Homepage popup ---------- */
html.ct-modal-open,
html.ct-modal-open body {
    overflow: hidden;
}

.ct-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    font-family: 'Roboto', 'Segoe UI', sans-serif;
}

.ct-modal[hidden] {
    display: none;
}

.ct-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.62);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.ct-modal-dialog {
    position: relative;
    width: 100%;
    max-width: 800px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow: auto;
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
    opacity: 0;
    transform: translateY(16px) scale(0.97);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.ct-modal-dialog:focus {
    outline: none;
}

.ct-modal.is-open .ct-modal-backdrop { opacity: 1; }
.ct-modal.is-open .ct-modal-dialog { opacity: 1; transform: none; }

.ct-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: #344054;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);
    transition: background 0.2s ease, color 0.2s ease;
}

.ct-modal-close:hover { background: #ffffff; color: #ff4d0d; }
.ct-modal-close:focus-visible { outline: 3px solid #ff6a1a; outline-offset: 2px; }

.ct-modal-body {
    padding: 34px 30px 28px;
}

.ct-pill {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid #ffd2b3;
    border-radius: 999px;
    background: #fff4ec;
    color: #f0561d;
    font-size: 13px;
    font-weight: 600;
}

.ct-title {
    margin: 14px 0 0;
    color: #101828;
    font-size: clamp(20px, 2.6vw, 25px);
    font-weight: 700;
    line-height: 1.3;
}

.ct-prize-label {
    margin: 14px 0 0;
    color: #475467;
    font-size: 14px;
    font-weight: 600;
}

.ct-prize {
    margin: 0;
    font-size: clamp(36px, 6vw, 48px);
    font-weight: 800;
    line-height: 1.1;
    color: #ff4d0d;
    background: linear-gradient(135deg, #ff8a2a, #ff3d00);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ct-desc {
    margin: 12px 0 0;
    color: #475467;
    font-size: 15px;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ct-countdown {
    margin-top: 18px;
}

.ct-countdown-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 8px;
    color: #f0561d;
    font-size: 13px;
    font-weight: 700;
}

.ct-countdown-label svg {
    width: 16px;
    height: 16px;
}

.ct-countdown-boxes {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-width: 320px;
}

.ct-countdown-boxes div {
    padding: 8px 4px;
    border: 1px solid #ffe0cc;
    border-radius: 12px;
    background: #fff4ec;
    text-align: center;
}

.ct-countdown-boxes span {
    display: block;
    color: #101828;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.ct-countdown-boxes small {
    color: #667085;
    font-size: 11px;
}

.ct-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    margin-top: 22px;
}

.ct-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 26px;
    border-radius: 999px;
    background: linear-gradient(135deg, #ff8a2a, #ff4d0d);
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 6px 18px rgba(255, 77, 13, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ct-btn-primary:hover {
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(255, 77, 13, 0.45);
}

.ct-btn-primary:focus-visible { outline: 3px solid #101828; outline-offset: 3px; }

.ct-btn-later {
    padding: 8px 4px;
    border: none;
    background: none;
    color: #667085;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.ct-btn-later:hover { color: #101828; text-decoration: underline; }
.ct-btn-later:focus-visible { outline: 2px solid #ff6a1a; outline-offset: 2px; border-radius: 6px; }

.ct-modal-media {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    min-height: 100%;
    overflow: hidden;
    background: radial-gradient(circle at 50% 35%, #ffe3cf 0%, #fff4ec 60%, #fff8f3 100%);
}

.ct-modal-media img {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 460px;
    object-fit: contain;
    object-position: bottom center;
}

/* Phones: image on top, single column */
@media (max-width: 640px) {
    .ct-modal-dialog {
        grid-template-columns: 1fr;
        max-width: 440px;
    }

    .ct-modal-media {
        order: -1;
        height: 190px;
        min-height: 0;
    }

    .ct-modal-media img {
        max-height: 190px;
    }

    .ct-modal-body {
        padding: 22px 20px 22px;
    }

    .ct-countdown-boxes {
        max-width: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ct-float,
    .ct-float-label,
    .ct-modal-backdrop,
    .ct-modal-dialog,
    .ct-btn-primary {
        transition: none;
    }

    .ct-float::before {
        animation: none;
    }
}

@media print {
    .ct-float,
    .ct-modal {
        display: none !important;
    }
}
