/**
 * TOP Video Random Player - Frontend Styles
 *
 * @package TOPVRP
 */

/* Reset body margin when fullscreen is active */
body.topvrp-fullscreen-active {
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

/* Player container base */
.topvrp-player-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
}

/* Fullscreen mode */
.topvrp-player-container.topvrp-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
}

/* Non-fullscreen mode - for testing - FORCE 80% */
.topvrp-player-container:not(.topvrp-fullscreen) {
    position: relative !important;
    display: block !important;
    margin: 10vh auto !important;
    max-width: 80vw !important;
    max-height: 80vh !important;
    width: 80vw !important;
    height: 80vh !important;
    left: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    z-index: 1 !important;
}

/* Override body when container is not fullscreen */
body:not(.topvrp-fullscreen-active) .topvrp-player-container:not(.topvrp-fullscreen),
body.topvrp-fullscreen-active .topvrp-player-container:not(.topvrp-fullscreen) {
    position: relative !important;
    width: 80vw !important;
    height: 80vh !important;
    margin: 10vh auto !important;
}

/* Cover mode - video fills container */
.topvrp-player-container.topvrp-cover iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 177.78vh; /* 16:9 aspect ratio */
    height: 100vh;
    min-width: 100vw;
    min-height: 56.25vw; /* 16:9 aspect ratio */
    transform: translate(-50%, -50%);
}

/* Ensure Vimeo controls are visible and not hidden */
.topvrp-player-container iframe {
    pointer-events: auto !important;
}

/* Ensure controls are accessible - Vimeo controls should be on top */
.topvrp-player-container .vp-controls,
.topvrp-player-container iframe[src*="vimeo"] {
    z-index: 10 !important;
}

/* Non-cover mode - contain video */
.topvrp-player-container:not(.topvrp-cover) iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Error message styling */
.topvrp-error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    padding: 20px;
    background: #1a1a1a;
    color: #ff6b6b;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 16px;
    text-align: center;
}

/* Loading state */
.topvrp-player-container.topvrp-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: topvrp-spin 0.8s linear infinite;
    z-index: 10;
}

@keyframes topvrp-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error state within container */
.topvrp-player-container .topvrp-player-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px 30px;
    background: rgba(0, 0, 0, 0.8);
    color: #ff6b6b;
    font-size: 14px;
    text-align: center;
    border-radius: 4px;
    z-index: 20;
}
