/* ===================================================
   WooReels Commerce Pro — Frontend CSS
   =================================================== */

/* ---- Carousel wrapper -------------------------------- */
.wooreels-carousel {
    position: relative;
    width: 100%;
    --reel-radius: 18px;
    --reel-aspect: 9/16;
}
.wooreels-carousel__viewport {
    overflow: hidden;
}

/* ---- Reel card --------------------------------------- */
.wooreels-reel {
    background: #111;
    border-radius: var(--reel-radius);
    color: #fff;
    overflow: hidden;
    /* box-shadow: 0 16px 40px rgba(0,0,0,.18); */
    display: flex;
    flex-direction: column;
    height: 100%;
}
.wooreels-reel--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    background: #1a1a1a;
}
.wooreels-reel__empty-msg {
    text-align: center;
    color: #aaa;
    padding: 24px;
}

/* ---- Media area ------------------------------------- */
.wooreels-reel__media {
    position: relative;
    aspect-ratio: var(--reel-aspect);
    background: #000;
    overflow: hidden;
    cursor: pointer;
}
.wooreels-reel__image,
.wooreels-reel__video,
.wooreels-reel__embed {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border: none;
}
.wooreels-reel__embed {
    pointer-events: none; /* card view: click opens popup, not iframe */
}
.wooreels-reel__play-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: rgba(255,255,255,.85);
    text-shadow: 0 2px 8px rgba(0,0,0,.5);
    opacity: 0;
    transition: opacity .2s;
    pointer-events: none;
}
.wooreels-reel__media:hover .wooreels-reel__play-icon {
    opacity: 1;
}
.wooreels-reel__fallback a {
    color: #fff;
    text-decoration: underline;
    padding: 16px;
    display: block;
}
.wooreels-reel__instagram {
    width: 100%;
    height: 100%;
}

/* ---- Product strip on card -------------------------- */
.wooreels-reel__product {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255,255,255,.08);
}
.wooreels-reel__product-img img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}
.wooreels-reel__product-info {
    flex: 1;
    overflow: hidden;
}
.wooreels-reel__product-name {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wooreels-reel__product-price {
    margin: 2px 0 0;
    font-size: 13px;
    color: #fff;
}
.wooreels-reel__product-price .amount { color: #4caf50; font-weight: 700; }
.wooreels-reel__product-price del    { color: #888; font-size: 11px; }

/* ---- Action buttons on card ------------------------- */
.wooreels-reel__actions {
    display: flex;
    gap: 6px;
    padding: 8px 10px 12px;
    flex-wrap: wrap;
}

/* ---- Generic button style --------------------------- */
.wooreels-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 10px;
    transition: background .15s, opacity .15s;
    text-decoration: none;
    line-height: 1.2;
    white-space: nowrap;
}
.wooreels-btn:disabled { opacity: .6; cursor: not-allowed; }
.wooreels-btn--wishlist {
    background: rgba(255,255,255,.12);
    color: #fff;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.wooreels-btn--wishlist.wooreels-btn--active .wooreels-btn__icon { color: #e91e63; }
.wooreels-btn--share {
    background: rgba(255,255,255,.12);
    color: #fff;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.wooreels-btn--cart {
    background: #fff;
    color: #111;
    flex: 1;
}
.wooreels-btn--cart:hover { background: #f0f0f0; }
.wooreels-btn--buy {
    background: #ff6900;
    color: #fff;
    flex: 1;
}
.wooreels-btn--buy:hover { background: #e05f00; }
.wooreels-btn--lg { font-size: 14px; padding: 10px 16px; }
.wooreels-btn--sm { font-size: 11px; padding: 4px 8px; }

/* ---- Navigation arrows ------------------------------ */
.wooreels-carousel__prev,
.wooreels-carousel__next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    background: rgba(0,0,0,.6) !important;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 18px !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swiper-button-next:after, .swiper-button-prev:after{
    font-size: 18px;
}

.wooreels-carousel__prev { left: 4px; }
.wooreels-carousel__next { right: 4px; }

/* ---- Popup / Modal ---------------------------------- */
.wooreels-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.wooreels-modal[hidden] { display: none; }
.wooreels-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.75);
    backdrop-filter: blur(4px);
}
.wooreels-modal__inner {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 960px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0,0,0,.4);
}
.wooreels-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0,0,0,.1);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.wooreels-modal__close:hover { background: rgba(0,0,0,.2); }
body.wooreels-modal-open { overflow: hidden; }

/* ---- Popup layout ----------------------------------- */
.wooreels-popup {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    min-height: 520px;
}
.wooreels-popup__video-col {
    background: #000;
    border-radius: 20px 0 0 20px;
    overflow: hidden;
    display: flex;
    align-items: stretch;
}
.wooreels-popup__embed-wrap {
    width: 100%;
}
.wooreels-popup__embed-wrap iframe,
.wooreels-popup__embed-wrap video {
    width: 100%;
    height: 100%;
    min-height: 400px;
    object-fit: cover;
    border: none;
    display: block;
}
.wooreels-popup__details-col {
    padding: 28px 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.wooreels-popup__reel-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #111;
}
.wooreels-popup__reel-desc {
    font-size: 14px;
    color: #555;
    margin: 0;
}

/* ---- Popup product card ----------------------------- */
.wooreels-popup__product-card {
    display: flex;
    gap: 12px;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 12px;
}
.wooreels-popup__product-gallery img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}
.wooreels-popup__product-meta { flex: 1; }
.wooreels-popup__product-name { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.wooreels-popup__product-name a { color: #111; text-decoration: none; }
.wooreels-popup__product-name a:hover { text-decoration: underline; }
.wooreels-popup__product-price { font-size: 15px; font-weight: 700; color: #e44; }
.wooreels-popup__product-price .amount { color: #4caf50; }
.wooreels-popup__product-price del .amount { color: #999; font-weight: 400; }
.wooreels-popup__product-excerpt { font-size: 13px; color: #666; margin-top: 6px; }

/* ---- Popup actions ---------------------------------- */
.wooreels-popup__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ---- Popup more products ---------------------------- */
.wooreels-popup__more-products h4 {
    font-size: 13px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin: 0 0 10px;
}
.wooreels-popup__extra-product {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}
.wooreels-popup__extra-img img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
}
.wooreels-popup__extra-info { flex: 1; font-size: 13px; }
.wooreels-popup__extra-info a { color: #111; text-decoration: none; display: block; font-weight: 600; }
.wooreels-popup__extra-info span { color: #4caf50; font-weight: 700; }

/* ---- Share panel ------------------------------------ */
.wooreels-share-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99998;
    background: #fff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 40px rgba(0,0,0,.18);
    padding: 20px;
    animation: wooreels-slide-up .25s ease;
}
.wooreels-share-panel[hidden] { display: none; }
@keyframes wooreels-slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}
.wooreels-share-panel__inner { max-width: 480px; margin: auto; }
.wooreels-share-panel__close {
    position: absolute;
    top: 12px;
    right: 16px;
    color: #000000 !important;
    background: #ffffff00 !important;
    border: 0px !important;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 14px;
}
.wooreels-share-panel h3 { margin: 0 0 16px; font-size: 16px; }
.wooreels-share-panel__channels {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.wooreels-share-channel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 16px;
    border-radius: 10px;
    background: #f5f5f5;
    color: #111;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background .15s;
    flex: 1;
    min-width: 100px;
    text-align: center;
}
.wooreels-share-channel:hover { background: #e8e8e8; }

/* ---- Toast notification ----------------------------- */
.wooreels-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #222;
    color: #fff;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    z-index: 99999;
    animation: wooreels-fade-in .2s ease;
    pointer-events: none;
}
@keyframes wooreels-fade-in {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---- Responsive ------------------------------------ */
@media (max-width: 768px) {
    .wooreels-carousel { padding: 0 4px; }
    .wooreels-popup { grid-template-columns: 1fr; }
    .wooreels-popup__video-col { border-radius: 20px 20px 0 0; min-height: 280px; }
    .wooreels-popup__embed-wrap iframe,
    .wooreels-popup__embed-wrap video { min-height: 280px; }
    .wooreels-modal__inner { border-radius: 16px; }
}
@media (max-width: 480px) {
    .wooreels-reel__actions { gap: 4px; }
    .wooreels-btn--cart,
    .wooreels-btn--buy { font-size: 11px; padding: 5px 8px; }
}

/* ===================================================
   v2 additions — video, toast levels, gallery, autoplay
   =================================================== */

/* ---- Instagram card thumbnail ----------------------- */
.wooreels-reel__ig-card,
.wooreels-reel__video-card {
    position: relative;
    width: 100%;
    height: 100%;
}
.wooreels-reel__ig-thumb,
.wooreels-reel__video-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.wooreels-reel__play-badge {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.28);
    transition: background .2s;
}
.wooreels-reel__media:hover .wooreels-reel__play-badge {
    background: rgba(0,0,0,.42);
}
.wooreels-reel__play-badge svg {
    width: 48px;
    height: 48px;
    color: #fff;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,.5));
}

/* ---- Video in card ---------------------------------- */
.wooreels-reel__video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #000;
}
.wooreels-reel__video--popup {
    width: 100%;
    height: 100%;
    min-height: 360px;
    background: #000;
    object-fit: contain;
}

/* ---- Popup media wrap ------------------------------- */
.wooreels-popup__media-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 400px;
    background: #000;
    display: flex;
    align-items: stretch;
}
.wooreels-popup__media-wrap video,
.wooreels-popup__media-wrap iframe {
    width: 100%;
    height: 100%;
    min-height: 400px;
    object-fit: cover;
    border: none;
    display: block;
}
/* Overlay shown when autoplay is blocked */
.wooreels--autoplay-blocked::after {
    content: '▶';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
    color: rgba(255,255,255,.9);
    cursor: pointer;
    background: rgba(0,0,0,.3);
    pointer-events: none;
}

/* ---- Popup product gallery swiper ------------------- */
.wooreels-popup__gallery-swiper {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 12px;
}
.wooreels-popup__gallery-img {
    width: 100%;
    height: 240px;
    object-fit: cover;
    border-radius: 12px;
    display: block;
}
.wooreels-popup__gallery-swiper .swiper-button-prev,
.wooreels-popup__gallery-swiper .swiper-button-next {
    width: 28px;
    height: 28px;
    background: rgba(0,0,0,.55);
    border-radius: 50%;
    color: #fff;
}
.wooreels-popup__gallery-swiper .swiper-button-prev::after,
.wooreels-popup__gallery-swiper .swiper-button-next::after {
    font-size: 12px;
}
.wooreels-popup__gallery-dots {
    bottom: 6px;
}

/* ---- Toast levels ----------------------------------- */
.wooreels-toast { opacity: 0; transition: opacity .3s, transform .3s; transform: translateX(-50%) translateY(16px); }
.wooreels-toast--visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.wooreels-toast--success { background: #1a7f37; }
.wooreels-toast--error   { background: #c0392b; padding: 12px 24px; }
.wooreels-toast--info    { background: #222; }
