/* FILE: public/tailstore/assets/css/custom.css */

/* ============================================================
   GLOBAL TYPOGRAPHY
============================================================ */
h1,
h2,
h3,
h4,
h5,
h6,
p,
a,
span,
label,
input,
textarea,
button {
    font-family: 'Manrope', sans-serif;
}

/* ============================================================
   BASIC LAYOUT HELPERS
============================================================ */
.container {
    max-width: 1280px;
}

img {
    max-width: 100%;
    display: block;
}

/* Prevent "white box" syndrome */
.bg-white {
    background-color: #ffffff;
}

/* ============================================================
   CARD SYSTEM (USED EVERYWHERE)
============================================================ */
.card,
.product-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    box-shadow: 0 6px 16px rgba(0,0,0,0.04);
    transition: all 0.25s ease;
}

.card:hover,
.product-card:hover {
    box-shadow: 0 14px 32px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

/* ============================================================
   PRODUCT GRID FIXES
============================================================ */
.product-card img {
    background-color: #f3f4f6;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================================
   BUTTON NORMALIZATION
============================================================ */
button,
.btn {
    transition: all 0.2s ease;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================================
   FORMS (CART / CHECKOUT)
============================================================ */
input[type="text"],
input[type="number"],
textarea {
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 0.75rem;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: #ff0042;
    box-shadow: 0 0 0 2px rgba(255, 0, 66, 0.15);
}

/* ============================================================
   HEADER / MOBILE MENU
============================================================ */
.mobile-menu {
    padding: 2rem;
}

.mobile-menu ul {
    width: 100%;
    text-align: center;
}

.mobile-menu li {
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem 0;
}

/* ============================================================
   DROPDOWNS / MICRO ANIMATIONS
============================================================ */
.dropdown-enter-active,
.dropdown-leave-active {
    transition: opacity 0.12s ease, transform 0.12s ease;
}
.dropdown-enter-from,
.dropdown-leave-to {
    opacity: 0;
    transform: scale(0.95);
}

/* Hover scale for icons */
@keyframes scaleUp {
    from { transform: scale(1); }
    to { transform: scale(1.15); }
}

.group-hover\:scale-120:hover {
    animation: scaleUp 0.25s forwards;
}

/* Search dropdown */
@keyframes slideDown {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.search-slide-down {
    animation: slideDown 0.25s ease forwards;
}

/* ============================================================
   SLIDER SAFETY (NO BREAKAGE IF UNUSED)
============================================================ */
.swiper {
    width: 100%;
    height: 100%;
}

.swiper-slide {
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swiper-slide img {
    object-fit: cover;
}

/* ============================================================
   PRODUCT DETAIL TABS (FUTURE READY)
============================================================ */
.tab {
    padding: 0.5rem 1rem;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    cursor: pointer;
}

.tab:hover {
    border-color: #ff0042;
}

.tab.active {
    color: #ff0042;
    border-color: #ff0042;
}

.tab-content {
    display: none;
}

.tab-content:not(.hidden) {
    display: block;
}

/* ============================================================
   CHECKBOXES
============================================================ */
.custom-checkbox {
    appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 0.25rem;
    border: 1px solid #d1d5db;
    background: #ffffff;
    cursor: pointer;
}

.custom-checkbox:checked {
    background-color: #ff0042;
    border-color: #ff0042;
}

/* ============================================================
   STOREFRONT: UNIVERSAL PRODUCT THUMBNAILS (GLOBAL, STABLE)
============================================================ */
:root{
    --sf-thumb-xxs: 56px;
    --sf-thumb-xs:  64px;
    --sf-thumb-sm:  72px;
    --sf-thumb-md:  78px;
    --sf-thumb-lg:  96px;
    --sf-thumb-radius: 12px;
    --sf-thumb-border: rgba(255,255,255,0.12);
    --sf-thumb-bg: rgba(0,0,0,0.20);
}

.sf-thumb,
.sf-prod-thumb{
    width: var(--sf-thumb-md);
    height: var(--sf-thumb-md);
    border-radius: var(--sf-thumb-radius);
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 var(--sf-thumb-md);
    background: var(--sf-thumb-bg);
    border: 1px solid var(--sf-thumb-border);
    box-sizing: border-box;
}

.sf-thumb--xxs{ width: var(--sf-thumb-xxs); height: var(--sf-thumb-xxs); flex-basis: var(--sf-thumb-xxs); }
.sf-thumb--xs { width: var(--sf-thumb-xs);  height: var(--sf-thumb-xs);  flex-basis: var(--sf-thumb-xs);  }
.sf-thumb--sm { width: var(--sf-thumb-sm);  height: var(--sf-thumb-sm);  flex-basis: var(--sf-thumb-sm);  }
.sf-thumb--md { width: var(--sf-thumb-md);  height: var(--sf-thumb-md);  flex-basis: var(--sf-thumb-md);  }
.sf-thumb--lg { width: var(--sf-thumb-lg);  height: var(--sf-thumb-lg);  flex-basis: var(--sf-thumb-lg);  }

.sf-thumb img,
.sf-prod-thumb img{
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
}

/* Product cards: enforce consistent image height */
.product-card img{
    width: 100%;
    height: 220px;
    object-fit: cover;
    object-position: center;
    border-top-left-radius: 1rem;
    border-top-right-radius: 1rem;
}

@media (max-width: 575px){
    .product-card img{
        height: 200px;
    }
}

/* ============================================================
   CHECKOUT: VIDEO AD PLACEHOLDER SYSTEM (NEW)
   ============================================================
   Problem: Injected ads bypass CSS constraints
   Solution: Create a strict container with Instagram 4:5 ratio
   ============================================================ */

/* 1. CREATE A VIDEO AD CONTAINER WITH INSTAGRAM SIZE (4:5 ratio) */
.sf-video-ad-container {
    /* Instagram/Reels optimal size: 1080x1350 (4:5 ratio) */
    width: 100% !important;
    max-width: 320px !important; /* Desktop size */
    aspect-ratio: 4 / 5 !important;
    height: auto !important;
    position: relative !important;
    overflow: hidden !important;
    border-radius: 16px !important;
    background: #000 !important; /* Black background for video */
    border: 1px solid rgba(0,0,0,0.1) !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12) !important;
    margin: 0 auto !important;
    display: block !important;
}

/* 2. CONSTRAIN ANY CONTENT INSIDE THE CONTAINER */
.sf-video-ad-container > *,
.sf-video-ad-container iframe,
.sf-video-ad-container video,
.sf-video-ad-container img,
.sf-video-ad-container object,
.sf-video-ad-container embed {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 3. SPECIFIC TARGETING FOR SKINNY COFFEE AD (right sidebar) */
/* Target the entire right sidebar container */
body.sf-page-checkout .sf-cart-wrap .row > .col-lg-4 {
    position: relative !important;
}

/* Replace the existing .sf-ad container with our constrained container */
body.sf-page-checkout .sf-cart-wrap .row > .col-lg-4 .sf-ad {
    display: none !important; /* Hide the original ad container */
}

/* 4. CREATE A NEW PLACEHOLDER CONTAINER IN THE RIGHT SIDEBAR */
#sf-skinny-coffee-ad-placeholder {
    display: block !important;
    width: 100% !important;
    max-width: 320px !important;
    margin: 16px auto !important;
    padding: 16px !important;
    background: white !important;
    border-radius: 20px !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08) !important;
    border: 1px solid #e5e7eb !important;
    text-align: center !important;
}

/* 5. STYLES FOR THE PLACEHOLDER LABEL */
.sf-ad-label {
    display: block !important;
    font-size: 11px !important;
    font-weight: 900 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.1em !important;
    color: #6b7280 !important;
    margin-bottom: 12px !important;
    text-align: center !important;
}

/* 6. SAFETY OVERRIDES - PREVENT ANY ADS FROM BREAKING OUT */
/* Nuclear option: Constrain any element that looks like an ad */
body.sf-page-checkout [class*="ad"],
body.sf-page-checkout [id*="ad"],
body.sf-page-checkout [class*="Ad"],
body.sf-page-checkout [id*="Ad"],
body.sf-page-checkout iframe[src*="skinny"],
body.sf-page-checkout iframe[src*="coffee"],
body.sf-page-checkout [src*="skinny"],
body.sf-page-checkout [src*="coffee"] {
    max-width: 320px !important;
    max-height: 400px !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 4 / 5 !important;
    display: inline-block !important;
    position: relative !important;
    overflow: hidden !important;
    border-radius: 16px !important;
}

/* 7. MOBILE RESPONSIVE */
@media (max-width: 768px) {
    .sf-video-ad-container {
        max-width: 280px !important; /* Slightly smaller on mobile */
    }

    #sf-skinny-coffee-ad-placeholder {
        max-width: 280px !important;
    }

    body.sf-page-checkout [class*="ad"],
    body.sf-page-checkout [id*="ad"] {
        max-width: 280px !important;
        max-height: 350px !important;
    }
}

/* 8. CHECKOUT PAGE SPECIFIC OVERRIDES */
/* First, clean up all previous checkout ad rules */
body.sf-page-checkout .sf-cart-wrap .row > .col-lg-4 .sf-ad__media,
body.sf-page-checkout .sf-cart-wrap .row > .col-lg-4 .sf-ad__frame,
body.sf-page-checkout .checkout-media,
body.sf-page-checkout .media-col,
body.sf-page-checkout .right-rail-media,
body.sf-page-checkout .promo-media {
    display: none !important; /* Hide all previous containers */
}

/* 9. NEW: If ad is injected via JavaScript, catch it */
.sf-video-ad-container [src*="skinny"],
.sf-video-ad-container [src*="coffee"],
.sf-video-ad-container iframe,
.sf-video-ad-container video {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
}

/* 10. ENSURE THE RIGHT COLUMN STAYS PROPER WIDTH */
@media (min-width: 992px) {
    body.sf-page-checkout .sf-cart-wrap .row > .col-lg-4 {
        flex: 0 0 360px !important;
        max-width: 360px !important;
    }

    /* Center the video ad in the right column */
    body.sf-page-checkout .sf-cart-wrap .row > .col-lg-4 .sf-video-ad-container {
        margin: 20px auto !important;
    }
}

/* ============================================================
   CHECKOUT: SUMMARY ROW SPACING (KEEP EXISTING)
============================================================ */

/* Summary spacing */
html[data-store-page="checkout"] .sf-co-summary-totalrow,
html[data-store-page="checkout"] .sf-co-summary-line,
body[data-store-page="checkout"] .sf-co-summary-totalrow,
body[data-store-page="checkout"] .sf-co-summary-line {
    padding: 10px 0 !important;
    line-height: 1.45 !important;
}

/* Structural fallback: checkout page contains the checkout submit form */
body:has(form[action*="checkout"]) .sf-co-summary-totalrow,
body:has(form[action*="checkout"]) .sf-co-summary-line {
    padding: 10px 0 !important;
    line-height: 1.45 !important;
}

/* ============================================================
   CLEAN UP UNUSED OLD RULES (SIMPLIFY)
============================================================ */

/* Remove old conflicting rules */
body.sf-page-checkout .sf-cart-wrap .row > .col-lg-4 .sf-ad,
body.sf-page-checkout .sf-cart-wrap .row > .col-lg-4 .sf-ad__media,
body.sf-page-checkout .sf-cart-wrap .row > .col-lg-4 .sf-ad__frame,
html[data-store-page="checkout"] .checkout-media,
html[data-store-page="checkout"] .checkout-hero,
html[data-store-page="checkout"] .checkout-banner {
    display: none !important;
}

/* ============================================================
   ADD JAVASCRIPT-INJECTED PLACEHOLDER SUPPORT
============================================================ */

/* This class will be added by JavaScript to contain the ad */
.sf-ad-loaded {
    display: block !important;
    width: 100% !important;
    max-width: 320px !important;
    height: 400px !important; /* 4:5 ratio (320x400) */
    background: #f9fafb !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    position: relative !important;
    margin: 20px auto !important;
    border: 2px dashed #d1d5db !important;
}

/* Loading state for ad */
.sf-ad-loading {
    background: linear-gradient(90deg, #f9fafb 25%, #f3f4f6 50%, #f9fafb 75%) !important;
    background-size: 200% 100% !important;
    animation: loading 1.5s infinite !important;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================
   SAFETY: PREVENT ADS FROM OVERFLOWING ANYWHERE ON CHECKOUT
============================================================ */
body.sf-page-checkout * {
    max-height: 100vh !important; /* Prevent full-page ads */
    overflow: visible !important;
}

/* Specifically target video elements on checkout */
body.sf-page-checkout video {
    max-width: 320px !important;
    max-height: 400px !important;
    width: 100% !important;
    height: auto !important;
    display: block !important;
    margin: 0 auto !important;
}

/* ============================================================
   INSTAGRAM-SPECIFIC SIZE CONSTRAINTS
============================================================ */
.sf-instagram-ratio {
    --instagram-width: 320px;
    --instagram-height: 400px; /* 4:5 ratio */
}

.sf-instagram-ratio,
[data-ad-format="instagram"],
[data-ad-ratio="4:5"] {
    width: var(--instagram-width) !important;
    height: var(--instagram-height) !important;
    max-width: var(--instagram-width) !important;
    max-height: var(--instagram-height) !important;
    aspect-ratio: 4 / 5 !important;
}
