/* ============================================================
   WPITMEDIACLOUD — Single Product Page — Anonymous CSS
   v2.0.0  |  Load on all single product pages
   
   This file ONLY contains:
     A) Overrides of existing theme/frontend CSS
     B) New shortcode + modal component styles
   
   Everything already handled by frontend-style.css and
   theme-style.css is intentionally omitted.
   ============================================================ */


/* ----------------------------------------------------------
   A. OVERRIDES OF EXISTING RULES
   ---------------------------------------------------------- */

/* Product title: existing theme-style.css sets color:gold —
   override to dark blue for the anonymous facelift           */
.fixed-content .product_title {
    color: #00008B !important;
}

/* Section header bars: existing frontend-style.css gives
   only gold text + margins. We add the dark bg + pill shape  */
h2.fe-area-title {
    background-color: #00008B !important;
    color: #FFD700 !important;
    padding: 0.3rem 0.75rem !important;
    border-radius: 0.4rem !important;
    font-size: 1rem !important;
    display: block;
}

/* Checkbox checked: existing theme-style.css uses gold —
   use primary blue to match button colour in anon mode       */
.wpit-cb-rd:checked {
    background-color: #5472D2 !important;
    border-color: #3558C8;
}



/* ----------------------------------------------------------
   B1. GALLERY — left column cosmetic improvements
   ---------------------------------------------------------- */

.single-product .product-images .swiper-entry {
    border-radius: 0.75rem;
    overflow: hidden;
}

.single-product .product-images .swiper-control-bottom .thumbnail-item {
    border-radius: 0.4rem !important;
    overflow: hidden;
    border: 2px solid transparent !important;
    transition: border-color 0.2s ease;
}

.single-product .product-images .swiper-control-bottom .thumbnail-item.active,
.single-product .product-images .swiper-control-bottom .thumbnail-item:hover {
    border-color: #5472D2;
}

.woocommerce-main-image {
	padding: 1rem !important;
	background-color: white !important;
}

/* Shortcode section label — appears above each sc block     */
.wpit-sc-area {
    margin-top: 1.25rem;
}

.wpit-sc-area-title {
    display: inline-block;
    background: #00008B;
    color: #FFD700;
    padding: 0.2rem 0.65rem;
    border-radius: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}


/* ----------------------------------------------------------
   B2. LOGIN BAR — new element, output by PHP for logged-in
   ---------------------------------------------------------- */

.content-page.container {
	margin-top: 1rem;
}

.wpit-login-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #FFF9E6;
    border: 1px solid #E6C200;
    border-radius: 0.5rem;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #5C3D00;
    margin-bottom: 1rem;
}

.wpit-login-bar::before {
    content: "✓";
    font-weight: 700;
    color: #8B6914;
}


/* ----------------------------------------------------------
   B3. MEDIA SHORTCODE — GRID
   ---------------------------------------------------------- */

.wpit-media-sc { margin-bottom: 0.75rem; }

.wpit-media-grid { display: grid; gap: 0.5rem; }
.wpit-media-grid.cols-1 { grid-template-columns: 1fr; }
.wpit-media-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.wpit-media-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.wpit-media-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.wpit-media-item {
    background: #f2f2f2;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.2s ease, transform 0.15s ease;
}

.wpit-media-item:hover { border-color: #5472D2; transform: translateY(-2px); }

.wpit-media-item:focus-visible {
    outline: 2px solid #5472D2;
    outline-offset: 2px;
}

/* Thumbnail — 4:3 ratio container */
.wpit-media-thumb-wrap {
    position: relative;
    padding-top: 75%;
    overflow: hidden;
    background: #e0e0e0;
}

.wpit-media-thumb-wrap img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.wpit-media-item:hover .wpit-media-thumb-wrap img { transform: scale(1.05); }

/* Video play icon */
.wpit-play-overlay {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 2.4rem; height: 2.4rem;
    border-radius: 50%;
    background: rgba(0,0,0,0.35);
    border: 2px solid rgba(255,255,255,0.75);
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-size: 0.9rem;
    padding-left: 0.15rem;
    pointer-events: none;
    transition: background 0.2s ease;
}

.wpit-media-item:hover .wpit-play-overlay { background: rgba(0,0,0,0.5); }

.wpit-media-item-title {
    padding: 0.35rem 0.5rem 0.2rem;
    font-size: 0.75rem;
    color: #444;
    font-weight: 500;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.wpit-media-btn {
    display: inline-block;
    margin: 0.2rem auto 0.5rem;
    background: #5472D2;
    color: white !important;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    text-decoration: none !important;
    transition: background 0.2s ease;
    border: none;
    cursor: pointer;
}

.wpit-media-btn:hover { background: #3558C8; color: white !important; }


/* ----------------------------------------------------------
   B4. MEDIA SHORTCODE — HERO
   ---------------------------------------------------------- */

.wpit-media-hero {
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid #ddd;
    background: #f2f2f2;
    margin-bottom: 0.5rem;
}

/* Hero main — 16:9 for videos/recipes; featured-ads use max-height */
.wpit-media-hero-main {
    position: relative;
    padding-top: 56.25%;
    overflow: hidden;
    cursor: pointer;
    background: white;
}

.wpit-media-sc[data-mediatype="featured-ads"] .wpit-media-hero-main {
    padding-top: 0;
    height: 30vh;
    max-height: 30vh;
}

.wpit-media-hero-main img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: contain;
}

.wpit-media-hero-main .wpit-play-overlay {
    width: 3.5rem; height: 3.5rem;
    font-size: 1.25rem;
}

/* Hero prev/next arrows */
.wpit-hero-nav {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.18);
    border: 1.5px solid rgba(255,255,255,0.5);
    color: white;
    border-radius: 50%;
    width: 2.2rem; height: 2.2rem;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
    padding: 0;
    transition: background 0.2s ease;
}

.wpit-hero-nav:hover { background: rgba(255,255,255,0.32); }
.wpit-hero-nav.prev { left: 0.6rem; }
.wpit-hero-nav.next { right: 0.6rem; }

/* Carousel */
.wpit-carousel-wrap {
    position: relative;
    padding: 0.4rem 1.8rem;
}

.wpit-carousel-track {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.wpit-carousel-track::-webkit-scrollbar { display: none; }

.wpit-carousel-slide {
    /* width set inline by PHP via flex-basis */
    flex-shrink: 0;
    scroll-snap-align: start;
    border-radius: 0.35rem;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent !important;
    position: relative;
    aspect-ratio: 1 / 1;
    background: #e0e0e0;
    transition: border-color 0.15s ease;
}

.wpit-carousel-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wpit-carousel-slide:hover, .wpit-carousel-slide.active { border-color: #5472D2; }
.wpit-carousel-slide:focus-visible { outline: 2px solid #5472D2; }

.wpit-carousel-slide .wpit-play-overlay {
    width: 1.5rem; height: 1.5rem;
    font-size: 0.55rem;
    border-width: 1px;
}

/* Desktop carousel scroll buttons */
.wpit-car-prev, .wpit-car-next {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    background: white;
    border: 1px solid #ccc;
    border-radius: 50%;
    width: 1.6rem; height: 1.6rem;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    color: #444;
    z-index: 5;
    padding: 0;
    line-height: 1;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.wpit-car-prev:hover, .wpit-car-next:hover { border-color: #5472D2; color: #5472D2; }
.wpit-car-prev { left: 0.1rem; }
.wpit-car-next { right: 0.1rem; }


/* ----------------------------------------------------------
   B5. MODAL
   ---------------------------------------------------------- */

.wpit-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    align-items: center;
    justify-content: center;
}

.wpit-modal.active { display: flex; }

.wpit-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.55);
    cursor: pointer;
}

.wpit-modal-box {
    position: relative;
    background: white;
    border-radius: 0.75rem;
    width: 80vw;
    max-width: 860px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 1.5rem;
    z-index: 1;
}

.wpit-modal-close {
    position: absolute;
    top: 0.75rem; right: 0.75rem;
    background: #f0f0f0;
    border: none;
    border-radius: 50%;
    width: 2rem; height: 2rem;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #444;
    line-height: 1;
    transition: background 0.15s ease;
    z-index: 10;
}

.wpit-modal-close:hover { background: #ddd; }

.wpit-modal-media {
    position: relative;
    width: 100%;
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
    margin-bottom: 1rem;
    display: flex; align-items: center; justify-content: center;
    min-height: 180px;
}

.wpit-modal-media img {
    max-width: 100%; max-height: 55vh;
    object-fit: contain; display: block;
}

.wpit-modal-media video {
    max-width: 100%; max-height: 55vh; display: block;
}

.wpit-modal-play-btn {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 4rem; height: 4rem;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: 2.5px solid rgba(255,255,255,0.75);
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 2;
    padding-left: 0.2rem;
    transition: background 0.2s ease, transform 0.2s ease;
}

.wpit-modal-play-btn:hover {
    background: rgba(255,255,255,0.28);
    transform: translate(-50%, -50%) scale(1.08);
}

.wpit-modal-video-note {
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
    margin-bottom: 0.75rem;
    line-height: 1.5;
    border-left: 3px solid #ddd;
    padding-left: 0.6rem;
}

.wpit-modal-title {
    font-size: 1rem !important;
    font-weight: 600;
    color: #00008B;
    margin-bottom: 0.8rem;
    line-height: 1.3;
}

.wpit-modal-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #5472D2;
    color: white !important;
    padding: 0.45rem 1.1rem;
    border-radius: 0.5rem;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s ease;
}

.wpit-modal-btn:hover { background: #3558C8; color: white !important; }


/* ----------------------------------------------------------
   B6. RESPONSIVE — new components only
   ---------------------------------------------------------- */

@media (max-width: 768px) {
    .wpit-media-grid.cols-3,
    .wpit-media-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }

    .wpit-modal-box { width: 95vw; max-height: 90vh; padding: 1rem; }

    .wpit-car-prev, .wpit-car-next { display: none; }
    .wpit-carousel-wrap { padding: 0.4rem 0; }
}

@media (max-width: 480px) {
    .wpit-media-grid.cols-2,
    .wpit-media-grid.cols-3,
    .wpit-media-grid.cols-4 { grid-template-columns: 1fr; }
}

/* ----------------------------------------------------------
   View More / View Less toggle button
   ---------------------------------------------------------- */

.wpit-viewmore-wrap {
    text-align: center;
    margin: 0.5rem 0 0.25rem;
}

.wpit-viewmore-btn {
    display: inline-block;
    background: transparent;
    border: 1.5px solid #5472D2;
    color: #5472D2;
    border-radius: 1rem;
    padding: 0.3rem 1.1rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.18s ease, color 0.18s ease;
}

.wpit-viewmore-btn:hover {
    background: #5472D2;
    color: white;
}

/* ----------------------------------------------------------
   No-preview notice inside modal
   ---------------------------------------------------------- */

.wpit-no-preview-note {
    font-size: 0.85rem;
    color: #555;
    background: #FFF9E6;
    border-left: 3px solid #C9A800;
    padding: 0.6rem 0.8rem;
    border-radius: 0 0.4rem 0.4rem 0;
    margin-bottom: 0.75rem;
    line-height: 1.5;
    font-style: normal !important;
}

/* ----------------------------------------------------------
   3D Depth-Swap transition for hero image autoplay
   ---------------------------------------------------------- */

.wpit-media-hero-main {
    perspective: 800px;
    transform-style: preserve-3d;
}

.wpit-media-hero-main img {
    transform-origin: center center;
    will-change: transform, opacity;
}

/* Phase 1: fly back into the screen */
@keyframes wpitDepthOut {
    0%   { transform: scale(1)    rotateY(0deg);    opacity: 1; }
    100% { transform: scale(0.70) rotateY(-15deg);  opacity: 0.4; }
}

/* Phase 2: fly forward out of the screen */
@keyframes wpitDepthIn {
    0%   { transform: scale(0.70) rotateY(15deg);  opacity: 0.4; }
    100% { transform: scale(1)    rotateY(0deg);   opacity: 1; }
}

.wpit-media-hero-main.wpit-depth-out img {
    animation: wpitDepthOut 300ms cubic-bezier(0.4, 0, 0.6, 1) forwards;
}

.wpit-media-hero-main.wpit-depth-in img {
    animation: wpitDepthIn 320ms cubic-bezier(0.2, 0.8, 0.4, 1) forwards;
}
