/**
 * Petsure Video Popup Widget Styles
 *
 * Play button with ripple animation + modal lightbox.
 *
 * @package Petsure_Core
 */

/* ===== Wrapper ===== */
.petsure-video-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ===== Background Image ===== */
.petsure-video-has-bg {
    width: 100%;
    min-height: 400px;
    overflow: hidden;
    border-radius: 16px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.petsure-video-bg-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

/* ===== Content Area ===== */
.petsure-video-content {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 150px;
    height: 150px;
}

/* ===== Text Path Circle ===== */
.petsure-video-tp {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.petsure-video-tp-rotate {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: petsure-tp-rotate var(--petsure-tp-speed, 12s) linear infinite;
}

.petsure-video-tp-svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
    padding: 10px;
}

.petsure-video-tp-text {
    fill: rgba(255, 255, 255, 0.85);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.petsure-video-tp-text a {
    fill: inherit;
    color: inherit;
}

@keyframes petsure-tp-rotate {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ===== Play Button inside text path ===== */
.petsure-video-has-tp .petsure-video-btn {
    position: relative;
    z-index: 2;
}

/* ===== Play Button ===== */
.petsure-video-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: var(--petsure-white);
    fill: var(--petsure-white);
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1;
    outline: none;
    padding: 20px;
}

.petsure-video-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.05);
}

.petsure-video-btn:active {
    transform: scale(0.95);
}

.petsure-video-btn i,
.petsure-video-btn svg {
    position: relative;
    z-index: 2;
    transition: color 0.3s ease, fill 0.3s ease;
    aspect-ratio: 1;
}

/* Ripple animation pseudo-elements */
.petsure-video-btn::before,
.petsure-video-btn::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    animation: petsure-video-ripple 2s ease-out infinite;
    pointer-events: none;
}

.petsure-video-btn::after {
    animation-delay: 1s;
}

@keyframes petsure-video-ripple {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* ── Init hidden state (prevents flash before CSS loads) ── */
.petsure-video-init {
    display: none !important;
}

/* ===== Modal Overlay ===== */
.petsure-video-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.petsure-video-modal-overlay.petsure-video-modal-open {
    display: flex;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ===== Modal Content ===== */
.petsure-video-modal-content {
    position: relative;
    width: 90%;
    max-width: 960px;
    background: var(--petsure-black);
    border-radius: 16px;
    overflow: hidden;
    transform: scale(0.85) translateY(30px);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.petsure-video-modal-open .petsure-video-modal-content {
    transform: scale(1) translateY(0);
}

/* ===== Close Button ===== */
.petsure-video-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: var(--petsure-white);
    cursor: pointer;
    z-index: 10;
    transition: background 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
    padding: 0;
    opacity: 0;
    transform: scale(0.5) rotate(-90deg);
}

.petsure-video-modal-open .petsure-video-modal-close {
    animation: petsure-modal-close-in 0.4s ease 0.3s forwards;
}

@keyframes petsure-modal-close-in {
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.petsure-video-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1) rotate(90deg);
}

.petsure-video-modal-close:active {
    transform: scale(0.9);
}

.petsure-video-modal-close svg {
    width: 20px;
    height: 20px;
}

/* ===== Player ===== */
.petsure-video-modal-player {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--petsure-black);
}

.petsure-video-modal-player iframe,
.petsure-video-modal-player video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: var(--petsure-black);
}

/* ============================================================ */
/*  CUSTOM CONTROLS (self-hosted only)                          */
/* ============================================================ */

.petsure-video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 12px 14px 10px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.6) 50%, transparent 100%);
    opacity: 0;
    transition: opacity 0.35s ease, transform 0.35s ease;
    transform: translateY(4px);
}

.petsure-video-controls.petsure-video-controls-visible {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

/* ---------- Progress Row ---------- */
.petsure-video-controls-top {
    padding: 0 0 8px;
}

.petsure-video-progress {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    cursor: pointer;
    transition: height 0.2s ease;
    position: relative;
}

/* Progress fill (works in Firefox) */
.petsure-video-progress::-moz-range-track {
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
}

.petsure-video-progress::-moz-range-progress {
    height: 4px;
    border-radius: 4px;
    background: var(--petsure-accent);
}

.petsure-video-progress::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
}

.petsure-video-progress::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--petsure-accent);
    border: 3px solid var(--petsure-white);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-top: -6px;
}

.petsure-video-progress::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

.petsure-video-progress::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--petsure-accent);
    border: 3px solid var(--petsure-white);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.petsure-video-progress:hover {
    height: 6px;
}

.petsure-video-progress:hover::-webkit-slider-runnable-track {
    height: 6px;
}

.petsure-video-progress:hover::-moz-range-track {
    height: 6px;
}

.petsure-video-progress:hover::-moz-range-progress {
    height: 6px;
}

.petsure-video-progress:hover::-webkit-slider-thumb {
    margin-top: -5px;
}

/* ---------- Bottom Row ---------- */
.petsure-video-controls-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.petsure-video-controls-left,
.petsure-video-controls-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ---------- Buttons ---------- */
.petsure-video-controls button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--petsure-white);
    cursor: pointer;
    transition: background 0.25s ease, transform 0.25s ease, color 0.25s ease;
    padding: 0;
    outline: none;
    position: relative;
}

.petsure-video-controls button:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(1.1);
    color: var(--petsure-accent);
}

.petsure-video-controls button:active {
    transform: scale(0.88);
}

.petsure-video-controls button:focus-visible {
    outline: 2px solid var(--petsure-accent);
    outline-offset: 2px;
}

.petsure-video-controls button svg {
    width: 20px;
    height: 20px;
    display: block;
    transition: transform 0.25s ease;
}

.petsure-video-controls button:hover svg {
    transform: scale(1.1);
}

/* ---------- Time Display ---------- */
.petsure-video-time-current,
.petsure-video-time-duration {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    font-variant-numeric: tabular-nums;
    user-select: none;
    line-height: 1;
    letter-spacing: 0.3px;
}

.petsure-video-time-sep {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    user-select: none;
    margin: 0 1px;
}

/* ---------- Volume Slider ---------- */
.petsure-video-volume-wrap {
    display: flex;
    align-items: center;
    gap: 0;
}

.petsure-video-volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 70px;
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    cursor: pointer;
    transition: height 0.2s ease;
}

.petsure-video-volume-slider::-moz-range-track {
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
}

.petsure-video-volume-slider::-moz-range-progress {
    height: 4px;
    border-radius: 4px;
    background: var(--petsure-accent);
}

.petsure-video-volume-slider::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
}

.petsure-video-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--petsure-accent);
    border: 2px solid var(--petsure-white);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
    margin-top: -5px;
}

.petsure-video-volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.petsure-video-volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--petsure-accent);
    border: 2px solid var(--petsure-white);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.petsure-video-volume-slider:hover {
    height: 6px;
}

.petsure-video-volume-slider:hover::-webkit-slider-runnable-track {
    height: 6px;
}

.petsure-video-volume-slider:hover::-moz-range-track {
    height: 6px;
}

.petsure-video-volume-slider:hover::-moz-range-progress {
    height: 6px;
}

.petsure-video-volume-slider:hover::-webkit-slider-thumb {
    margin-top: -4px;
}

/* ---------- Fullscreen Handling ---------- */
.petsure-video-modal-player:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    aspect-ratio: auto;
    background: var(--petsure-black);
}

.petsure-video-modal-player:-webkit-full-screen video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.petsure-video-modal-player:-moz-full-screen {
    width: 100vw;
    height: 100vh;
    aspect-ratio: auto;
}

.petsure-video-modal-player:fullscreen {
    width: 100vw;
    height: 100vh;
    aspect-ratio: auto;
    background: var(--petsure-black);
}

.petsure-video-modal-player:fullscreen video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ===== Responsive ===== */
@media (max-width: 767px) {
    .petsure-video-modal-content {
        width: 95%;
        border-radius: 12px;
    }

    .petsure-video-modal-close {
        top: 12px;
        right: 12px;
        width: 34px;
        height: 34px;
    }
}