/* Frontend Styles per HTML5 Animations Manager */

.h5a-animation-container {
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    display: none;
}

.h5a-animation-container.h5a-active {
    display: block;
}

.h5a-animation-container iframe.h5a-iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Responsive container */
.h5a-animation-container.h5a-responsive {
    max-width: 100%;
}

.h5a-animation-container.h5a-responsive iframe {
    width: 100%;
    height: 100%;
}

/* Aspect ratio helpers */
.h5a-aspect-16-9 {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
}

.h5a-aspect-16-9 iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.h5a-aspect-4-3 {
    position: relative;
    padding-bottom: 75%; /* 4:3 */
    height: 0;
}

.h5a-aspect-4-3 iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Loading state */
.h5a-animation-container.h5a-loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: h5a-spin 1s linear infinite;
    z-index: 1000;
}

@keyframes h5a-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Fixed positioning adjustments */
.h5a-animation-container[style*="position: fixed"],
.h5a-animation-container[style*="position:fixed"] {
    pointer-events: auto;
}

/* Inline animations (non-iframe) */
.h5a-inline-container {
    position: relative;
    overflow: hidden;
}

.h5a-inline-container > * {
    max-width: 100%;
}

/* Transition effects */
.h5a-fade-in {
    animation: h5aFadeIn 0.5s ease-in;
}

@keyframes h5aFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.h5a-slide-in-up {
    animation: h5aSlideInUp 0.5s ease-out;
}

@keyframes h5aSlideInUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.h5a-slide-in-left {
    animation: h5aSlideInLeft 0.5s ease-out;
}

@keyframes h5aSlideInLeft {
    from {
        transform: translateX(-50px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.h5a-scale-in {
    animation: h5aScaleIn 0.5s ease-out;
}

@keyframes h5aScaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mobile optimizations */
@media screen and (max-width: 768px) {
    .h5a-animation-container {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .h5a-animation-container[style*="position: fixed"],
    .h5a-animation-container[style*="position:fixed"] {
        position: relative !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .h5a-animation-container.h5a-loading::before {
        border-color: #333;
        border-top-color: #2196F3;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .h5a-animation-container {
        outline: 2px solid currentColor;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .h5a-animation-container,
    .h5a-animation-container *,
    .h5a-fade-in,
    .h5a-slide-in-up,
    .h5a-slide-in-left,
    .h5a-scale-in {
        animation: none !important;
        transition: none !important;
    }
}

/* Print styles */
@media print {
    .h5a-animation-container {
        display: none !important;
    }
}

/* Common positioning classes */
.h5a-center {
    margin-left: auto;
    margin-right: auto;
}

.h5a-full-width {
    width: 100%;
    max-width: 100%;
}

.h5a-full-height {
    height: 100vh;
}

/* Overlay styles */
.h5a-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9998;
    display: none;
}

.h5a-overlay.active {
    display: block;
}

.h5a-animation-container.h5a-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* Close button for modal animations */
.h5a-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    z-index: 10;
    transition: background 0.3s;
}

.h5a-close-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Accessibility */
.h5a-animation-container:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.h5a-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Performance hints */
.h5a-animation-container,
.h5a-iframe {
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* GPU acceleration */
.h5a-animation-container.h5a-accelerated {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}
