/* ============================================================
   Astral Video Commerce — Video Player Styles v2
   Theme: Wrookers (Dark + Gold)
   ============================================================ */

/* ─── CSS Custom Properties — Wrookers Theme ─── */
:root {
    --avc-gold: #c8a24e;
    --avc-gold-light: #dbb963;
    --avc-gold-dark: #a8853e;
    --avc-accent: #c8a24e;
    --avc-accent-hover: #dbb963;
    --avc-bg-dark: #0d0d0d;
    --avc-bg-surface: #1a1710;
    --avc-bg-overlay: rgba(10, 10, 8, 0.97);
    --avc-glass: rgba(200, 162, 78, 0.08);
    --avc-glass-border: rgba(200, 162, 78, 0.25);
    --avc-text: #f5f0e5;
    --avc-text-muted: rgba(245, 240, 229, 0.6);
    --avc-icon-color: #ffffff;
    --avc-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    --avc-trigger-size: 90px;
    --avc-z-trigger: 999990;
    --avc-z-overlay: 999999;
    --avc-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --avc-font: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    --avc-font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ─── Reset for plugin scope ─── */
#avc-widget-root,
#avc-widget-root *,
.avc-overlay,
.avc-overlay * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}


/* ═══════════ FLOATING TRIGGER — SQUARE REEL STYLE ═══════════ */
.avc-trigger {
    position: fixed;
    z-index: var(--avc-z-trigger);
    width: var(--avc-trigger-size);
    height: calc(var(--avc-trigger-size) * 1.35);
    cursor: pointer;
    transition: transform var(--avc-transition), box-shadow var(--avc-transition);
}

.avc-trigger[data-position="bottom-right"] {
    bottom: 24px;
    right: 24px;
}

.avc-trigger[data-position="bottom-left"] {
    bottom: 24px;
    left: 24px;
}

.avc-trigger:hover {
    transform: scale(1.05) translateY(-2px);
}

.avc-trigger:active {
    transform: scale(0.97);
}

/* Trigger — SQUARE video preview like a Reel */
.avc-trigger__preview {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--avc-gold);
    box-shadow:
        0 4px 20px rgba(200, 162, 78, 0.25),
        0 0 0 0 rgba(200, 162, 78, 0.3),
        0 8px 32px rgba(0, 0, 0, 0.3);
    animation: avc-pulse 2.5s ease-in-out infinite;
    position: relative;
    background: var(--avc-bg-dark);
}

.avc-trigger__preview video,
.avc-trigger__preview iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    display: block;
}

/* Instagram trigger iframe — crop aggressively at small size */
.avc-trigger__preview .avc-trigger-iframe--instagram {
    width: 300% !important;
    height: 300% !important;
    position: absolute !important;
    top: -50% !important;
    left: -100% !important;
    transform: scale(1);
    pointer-events: none;
}

/* Play icon overlay on trigger */
.avc-trigger__play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    background: rgba(13, 13, 13, 0.6);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(200, 162, 78, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avc-trigger__play-icon svg {
    width: 16px;
    height: 16px;
    fill: var(--avc-gold);
    margin-left: 2px;
}

/* "Reels" label at bottom of trigger */
.avc-trigger__label {
    position: absolute;
    bottom: 6px;
    left: 0;
    right: 0;
    text-align: center;
    font-family: var(--avc-font-ui);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--avc-gold);
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

/* Close mini button on trigger */
.avc-trigger__close {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--avc-bg-dark);
    border: 1.5px solid var(--avc-gold);
    color: var(--avc-gold);
    font-size: 10px;
    line-height: 17px;
    text-align: center;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--avc-transition), color var(--avc-transition);
}

.avc-trigger__close:hover {
    background: var(--avc-gold);
    color: var(--avc-bg-dark);
}

@keyframes avc-pulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(200, 162, 78, 0.2), 0 0 0 0 rgba(200, 162, 78, 0.25), 0 8px 32px rgba(0, 0, 0, 0.3); }
    50%      { box-shadow: 0 4px 20px rgba(200, 162, 78, 0.2), 0 0 0 8px rgba(200, 162, 78, 0), 0 8px 32px rgba(0, 0, 0, 0.3); }
}


/* ═══════════ FULL-SCREEN OVERLAY ═══════════ */
.avc-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: var(--avc-z-overlay);
    background: var(--avc-bg-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.avc-overlay.avc-overlay--open {
    opacity: 1;
    pointer-events: all;
}

/* ─── Player container ─── */
.avc-player {
    position: relative;
    width: 100%;
    max-width: 420px;
    height: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    overflow: hidden;
    background: var(--avc-bg-dark);
}

@media (min-width: 769px) {
    .avc-player {
        max-height: 94vh;
        border-radius: 16px;
        border: 1px solid var(--avc-glass-border);
        box-shadow: 0 0 60px rgba(0, 0, 0, 0.6), 0 0 120px rgba(200, 162, 78, 0.05);
    }
}

/* ─── Iframe Container + Swipe Overlay ─── */
.avc-iframe-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.avc-embed-iframe {
    width: 100%;
    height: 100%;
    border: none !important;
    position: absolute;
    top: 0;
    left: 0;
}

/* Instagram: aggressively scale and crop to hide ALL Instagram UI chrome */
.avc-iframe-container--instagram {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: hidden !important;
}

.avc-embed-iframe--instagram {
    width: 100% !important;
    height: 300% !important;
    position: absolute !important;
    top: -10% !important;
    left: 0 !important;
    transform: scale(1.15);
    transform-origin: center top;
    border: none !important;
}

/* Transparent swipe overlay — sits on top of iframe to capture touch gestures */
.avc-swipe-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    cursor: grab;
    background: transparent;
    -webkit-tap-highlight-color: transparent;
}

.avc-swipe-overlay:active {
    cursor: grabbing;
}

/* ─── Progress Bar (top) — Gold ─── */
.avc-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(245, 240, 229, 0.1);
    z-index: 10;
    overflow: hidden;
}

.avc-progress-bar__fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--avc-gold-dark), var(--avc-gold-light));
    transition: width 0.25s linear;
}

/* ─── Swiper wrapper ─── */
.avc-player .swiper {
    width: 100%;
    height: 100%;
}

.avc-player .swiper-slide {
    position: relative;
    overflow: hidden;
    background: var(--avc-bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
}

.avc-player .swiper-slide video,
.avc-player .swiper-slide iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border: none;
}

/* ─── Top Controls (Mute + Close) — Gold Glass ─── */
.avc-top-controls {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 15;
    display: flex;
    gap: 12px;
    align-items: center;
}

.avc-btn-icon {
    width: 42px !important;
    height: 42px !important;
    border-radius: 50% !important;
    background: rgba(0, 0, 0, 0.7) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid rgba(255, 255, 255, 0.3) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    color: #ffffff !important;
    transition: background 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    padding: 0 !important;
    margin: 0;
    line-height: 1 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.avc-btn-icon:hover {
    background: rgba(0, 0, 0, 0.85) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    color: #ffffff !important;
    transform: scale(1.08);
}

.avc-btn-icon:active {
    transform: scale(0.92);
}

.avc-btn-icon svg {
    width: 20px !important;
    height: 20px !important;
    fill: #ffffff !important;
    display: block !important;
}

/* ─── Side Action Buttons (Right) — Gold theme ─── */
.avc-side-actions {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 15;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.avc-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.avc-action-btn__icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1.5px solid rgba(255, 255, 255, 0.2) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #ffffff !important;
    transition: background 0.3s ease, transform 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.avc-action-btn__icon svg {
    width: 22px !important;
    height: 22px !important;
    fill: #ffffff !important;
    display: block !important;
}

.avc-action-btn:hover .avc-action-btn__icon {
    background: rgba(0, 0, 0, 0.75) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    color: #ffffff !important;
    transform: scale(1.1);
}

.avc-action-btn:active .avc-action-btn__icon {
    transform: scale(0.9);
}

.avc-action-btn--liked .avc-action-btn__icon {
    color: #ff4757 !important;
    border-color: #ff4757 !important;
}

.avc-action-btn--liked .avc-action-btn__icon svg {
    fill: #ff4757 !important;
}

.avc-action-btn__label {
    font-family: var(--avc-font-ui);
    font-size: 11px;
    color: var(--avc-text);
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* ─── Product Card (Bottom) — Wrookers Dark + Gold ─── */
.avc-product-card {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 15;
    background: linear-gradient(to top, rgba(13, 13, 11, 0.92) 0%, rgba(13, 13, 11, 0.6) 70%, transparent 100%);
    padding: 60px 14px 0 14px;
}

.avc-product-card__inner {
    background: rgba(26, 23, 16, 0.95);
    border: 1px solid var(--avc-glass-border);
    border-radius: 14px 14px 0 0;
    overflow: hidden;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.3);
}

.avc-product-card__info {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    gap: 12px;
    position: relative;
}

.avc-product-card__image {
    width: 70px;
    height: 70px;
    min-width: 70px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--avc-bg-dark);
    border: 1px solid var(--avc-glass-border);
}

.avc-product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avc-product-card__details {
    flex: 1;
    min-width: 0;
}

.avc-product-card__title {
    font-family: var(--avc-font-ui);
    font-size: 14px;
    font-weight: 600;
    color: var(--avc-text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.avc-product-card__pricing {
    margin-top: 4px;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.avc-product-card__price {
    font-family: var(--avc-font-ui);
    font-size: 16px;
    font-weight: 700;
    color: var(--avc-gold);
}

.avc-product-card__original-price {
    font-family: var(--avc-font-ui);
    font-size: 13px;
    color: var(--avc-text-muted);
    text-decoration: line-through;
}

.avc-product-card__link {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--avc-glass-border);
    border-radius: 6px;
    color: var(--avc-gold);
    text-decoration: none;
    transition: background var(--avc-transition), border-color var(--avc-transition);
}

.avc-product-card__link:hover {
    background: rgba(200, 162, 78, 0.1);
    border-color: var(--avc-gold);
}

.avc-product-card__link svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* CTA Button — Gold Gradient */
.avc-product-card__cta {
    font-family: var(--avc-font-ui);
    display: block;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--avc-gold-dark), var(--avc-gold), var(--avc-gold-light));
    color: var(--avc-bg-dark);
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border: none;
    cursor: pointer;
    transition: background var(--avc-transition), transform 0.15s ease, filter 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.avc-product-card__cta:hover {
    filter: brightness(1.1);
}

.avc-product-card__cta:active {
    transform: scale(0.98);
}

.avc-product-card__cta--success {
    background: #2e7d32 !important;
    color: #fff !important;
}

.avc-product-card__cta:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ─── Share Modal — Dark + Gold ─── */
.avc-share-modal {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    background: var(--avc-bg-surface);
    border: 1px solid var(--avc-glass-border);
    border-bottom: none;
    border-radius: 20px 20px 0 0;
    padding: 24px 20px 34px;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.4);
}

.avc-share-modal--open {
    transform: translateY(0);
}

.avc-share-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.avc-share-modal__title {
    font-family: var(--avc-font-ui);
    font-size: 18px;
    font-weight: 700;
    color: var(--avc-text);
}

.avc-share-modal__close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(200, 162, 78, 0.1);
    border: 1px solid var(--avc-glass-border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--avc-gold);
    transition: background var(--avc-transition);
}

.avc-share-modal__close:hover {
    background: rgba(200, 162, 78, 0.2);
}

.avc-share-modal__options {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.avc-share-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.avc-share-option__icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    transition: transform 0.2s ease;
}

.avc-share-option:hover .avc-share-option__icon {
    transform: scale(1.1);
}

.avc-share-option__label {
    font-family: var(--avc-font-ui);
    font-size: 11px;
    color: var(--avc-text-muted);
    font-weight: 500;
}

.avc-share-option--whatsapp .avc-share-option__icon { background: #25D366; color: #fff; }
.avc-share-option--facebook .avc-share-option__icon { background: #1877F2; color: #fff; }
.avc-share-option--twitter .avc-share-option__icon { background: #1DA1F2; color: #fff; }
.avc-share-option--copy .avc-share-option__icon { background: rgba(200, 162, 78, 0.15); color: var(--avc-gold); border: 1px solid var(--avc-glass-border); }
.avc-share-option--email .avc-share-option__icon { background: #EA4335; color: #fff; }

/* ─── Toast Notification — Gold accent ─── */
.avc-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(30px);
    background: rgba(26, 23, 16, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid var(--avc-glass-border);
    color: var(--avc-gold);
    padding: 12px 24px;
    border-radius: 12px;
    font-family: var(--avc-font-ui);
    font-size: 14px;
    font-weight: 500;
    z-index: 1000000;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}

.avc-toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ─── Loading spinner — Gold ─── */
.avc-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
}

.avc-loading__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(200, 162, 78, 0.15);
    border-top-color: var(--avc-gold);
    border-radius: 50%;
    animation: avc-spin 0.8s linear infinite;
}

@keyframes avc-spin {
    to { transform: rotate(360deg); }
}

/* ─── Empty state ─── */
.avc-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--avc-text-muted);
    text-align: center;
    padding: 40px;
}

.avc-empty-state__icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.avc-empty-state__text {
    font-family: var(--avc-font-ui);
    font-size: 16px;
    font-weight: 500;
}


/* ═══════════ RESPONSIVE ═══════════ */

@media (max-width: 768px) {
    .avc-player {
        max-width: 100%;
        border-radius: 0;
        max-height: 100vh;
        max-height: 100dvh;
    }

    .avc-trigger {
        --avc-trigger-size: 72px;
    }

    .avc-trigger[data-position="bottom-right"] {
        bottom: 16px;
        right: 16px;
    }

    .avc-trigger[data-position="bottom-left"] {
        bottom: 16px;
        left: 16px;
    }

    .avc-side-actions {
        right: 8px;
        gap: 12px;
    }

    .avc-action-btn__icon {
        width: 42px;
        height: 42px;
    }

    .avc-product-card__info {
        padding: 10px 12px;
    }

    .avc-product-card__image {
        width: 60px;
        height: 60px;
        min-width: 60px;
    }

    .avc-product-card__title {
        font-size: 13px;
    }

    .avc-product-card__cta {
        padding: 12px;
        font-size: 13px;
    }
}

@media (max-width: 360px) {
    .avc-trigger {
        --avc-trigger-size: 60px;
    }

    .avc-action-btn__icon {
        width: 38px;
        height: 38px;
    }

    .avc-action-btn__icon svg {
        width: 18px;
        height: 18px;
    }

    .avc-product-card__image {
        width: 50px;
        height: 50px;
        min-width: 50px;
    }
}

/* ─── Overlay scroll lock ─── */
.avc-overlay {
    overflow: hidden;
}

body.avc-body-locked {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
}
