/* Video container and wrapper styles */
.video-wrapper {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    background: #0f172a;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    aspect-ratio: 1/1; /* Ensure square aspect ratio */
}

/* Video element styles */
.philosophy-video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease-in-out, transform 0.3s ease-in-out;
    position: relative;
    z-index: 1;
}

/* Show video when it's loaded */
.philosophy-video.playing {
    opacity: 1;
}

/* Video fallback styles */
.video-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none; /* Initially hidden */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0f172a;
    color: #f8f9fa;
    text-align: center;
    padding: 2rem;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.video-fallback.visible {
    display: flex;
    opacity: 1;
}

.video-fallback-img {
    max-width: 60%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    opacity: 0.8;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.video-fallback-content {
    max-width: 100%;
}

.video-fallback-content p {
    margin: 0.5rem 0;
    color: #e2e8f0;
    line-height: 1.6;
}

.video-fallback-content a {
    color: #f5c76d;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
    border-bottom: 1px solid transparent;
}

.video-fallback-content a:hover {
    color: #f8d78f;
    border-bottom-color: #f5c76d;
}

.video-error-details {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 1rem;
    padding: 0.5rem;
    background: rgba(15, 23, 42, 0.8);
    border-radius: 4px;
    word-break: break-word;
}

/* Retry button */
.retry-button {
    display: inline-block;
    background: #f5c76d;
    color: #0b1124;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.2s ease;
    text-decoration: none;
}

.retry-button:hover {
    background: #f8d78f;
    transform: translateY(-1px);
}

.retry-button:active {
    transform: translateY(0);
}

/* Video loading state */
.video-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none; /* Start hidden, will be shown via JS */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.95);
    color: #f8f9fa;
    font-size: 1rem;
    transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
    z-index: 10;
    visibility: hidden;
    opacity: 0;
    padding: 2rem;
    text-align: center;
}

.video-loading.visible {
    display: flex;
    visibility: visible;
    opacity: 1;
}

.video-loading p {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: #94a3b8;
    letter-spacing: 0.5px;
    text-align: center;
    max-width: 80%;
    line-height: 1.5;
    transition: color 0.3s ease-in-out;
}

.video-loading p.error {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Loader animation */
.loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 2rem;
}

.loader-circle {
    width: 0.75rem;
    height: 0.75rem;
    background-color: #f5c76d;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
    opacity: 0.7;
}

.loader-circle:nth-child(1) { animation-delay: 0s; }
.loader-circle:nth-child(2) { animation-delay: 0.2s; }
.loader-circle:nth-child(3) { animation-delay: 0.4s; }
.loader-circle:nth-child(4) { animation-delay: 0.6s; }
.loader-circle:nth-child(5) { animation-delay: 0.8s; }

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.7;
        box-shadow: 0 0 0 rgba(248, 215, 138, 0.4);
    }
    50% {
        transform: scale(1.5);
        opacity: 1;
        background-color: #f8d88a;
        box-shadow: 0 0 15px rgba(248, 215, 138, 0.8);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .video-loading {
        padding: 1.5rem;
    }
    
    .video-loading p {
        font-size: 0.85rem;
        max-width: 100%;
    }
    
    .loader {
        transform: scale(0.9);
    }
}

/* Hide loading state when video is playing */
.video-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Video fallback image */
.video-fallback {
    display: block;
    width: 100%;
    height: auto;
}

/* Video controls (for when not muted/autoplay) */
.video-controls {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.video-wrapper:hover .video-controls {
    opacity: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .video-wrapper {
        max-width: 100%;
    }
}
