/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #000;
    color: #fff;
}

/* Video Container */
.video-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hosted Video */
.hosted-video {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #000;
}

.hosted-video.active {
    display: block;
}

/* Play Button Overlay */
.play-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(12, 57, 76, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.play-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.play-content {
    text-align: center;
    padding: 20px;
}

/* Play Icon SVG */
.play-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 8px #f2ef22) drop-shadow(0 0 16px rgba(242, 239, 34, 0.5));
    animation: pulseGlow 2s ease-in-out infinite;
    transition: transform 0.3s ease, filter 0.3s ease;
}

/* Pulse + Glow animation to attract attention */
@keyframes pulseGlow {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 8px #f2ef22) drop-shadow(0 0 16px rgba(242, 239, 34, 0.5));
    }
    50% {
        transform: scale(1.08);
        filter: drop-shadow(0 0 20px #f2ef22) drop-shadow(0 0 40px rgba(242, 239, 34, 0.8)) drop-shadow(0 0 60px rgba(96, 205, 246, 0.4));
    }
}

/* Hover effect (desktop/tablets) */
@media (hover: hover) {
    .play-overlay:hover .play-icon {
        transform: scale(1.15);
        filter: drop-shadow(0 0 25px #f2ef22) drop-shadow(0 0 50px rgba(242, 239, 34, 0.9));
        animation: none;
    }
}

.play-message {
    font-size: 16px;
    opacity: 0.95;
    font-weight: 400;
    color: #f6f6f6;
    margin-top: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background-color: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 15px 25px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    text-align: center;
}

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

.toast p {
    margin: 0;
}

/* Loading Spinner */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.loading-spinner p {
    font-size: 16px;
    opacity: 0.8;
}

/* Error Message */
.error-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    padding: 20px;
}

.error-message.active {
    display: flex;
}

.error-content {
    text-align: center;
    max-width: 400px;
}

.error-content h2 {
    font-size: 24px;
    margin-bottom: 15px;
}

.error-content p {
    font-size: 16px;
    opacity: 0.8;
    margin-bottom: 25px;
    line-height: 1.5;
}

.retry-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 15px 40px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.retry-button:active {
    transform: scale(0.95);
}

/* Fullscreen Specific Styles */
.video-container:-webkit-full-screen {
    width: 100%;
    height: 100%;
}

.video-container:-moz-full-screen {
    width: 100%;
    height: 100%;
}

.video-container:-ms-fullscreen {
    width: 100%;
    height: 100%;
}

.video-container:fullscreen {
    width: 100%;
    height: 100%;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .play-icon {
        width: 70px;
        height: 70px;
        margin-bottom: 16px;
    }

    .play-message {
        font-size: 14px;
    }
}

/* Orientation Hints */
@media (orientation: portrait) {
    .video-container {
        /* Portrait mode adjustments if needed */
    }
}

@media (orientation: landscape) {
    .video-container {
        /* Landscape mode optimizations */
    }
}

/* Prevent text selection during video */
.video-container,
.hosted-video,
.youtube-player {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* iOS Native Video Fullscreen - Hide Controls */
.hosted-video::-webkit-media-controls-panel,
.hosted-video::-webkit-media-controls-play-button,
.hosted-video::-webkit-media-controls-start-playback-button {
    display: none !important;
    opacity: 0 !important;
}

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

/* Redirect Animation Overlay */
.redirect-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(12, 57, 76, 0.98);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.redirect-overlay.active {
    display: flex;
    opacity: 1;
}

.redirect-content {
    text-align: center;
}

.redirect-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
}

/* Spinning circle animation */
.redirect-icon {
    position: absolute;
    top: 0;
    left: 0;
    width: 80px;
    height: 80px;
    animation: spinCircle 1.5s linear infinite;
}

@keyframes spinCircle {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.redirect-icon circle {
    stroke-dasharray: 226;
    stroke-dashoffset: 56.5;
    animation: dashAnimation 1.5s ease-in-out infinite;
}

@keyframes dashAnimation {
    0%, 100% {
        stroke-dashoffset: 56.5;
    }
    50% {
        stroke-dashoffset: 170;
    }
}

/* Checkmark - appears after 0.5s with draw animation */
.redirect-check {
    position: absolute;
    top: 0;
    left: 0;
    width: 80px;
    height: 80px;
    opacity: 0;
    animation: checkFadeIn 0.3s ease-in 0.5s forwards;
}

@keyframes checkFadeIn {
    to {
        opacity: 1;
    }
}

.redirect-check polyline {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: drawCheck 0.5s ease-out 0.5s forwards;
}

@keyframes drawCheck {
    to {
        stroke-dashoffset: 0;
    }
}

/* Redirect text */
.redirect-text {
    font-size: 18px;
    font-weight: 500;
    color: #f6f6f6;
    margin: 0;
    opacity: 0;
    animation: textFadeIn 0.4s ease-in 0.3s forwards;
}

@keyframes textFadeIn {
    to {
        opacity: 1;
    }
}

/* Mobile optimization for redirect */
@media (max-width: 768px) {
    .redirect-spinner {
        width: 70px;
        height: 70px;
    }

    .redirect-icon,
    .redirect-check {
        width: 70px;
        height: 70px;
    }

    .redirect-text {
        font-size: 16px;
    }
}
