/* ============================================================
   Enhanced Animations & Real-time Effects
   For Dynamic Images & Live Updates
   ============================================================ */

/* ── REAL-TIME IMAGE ANIMATIONS ────────────────────────── */

/* Fade-in Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Zoom-in Animation */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Slide-in Animation */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* Float Animation (hover effect) */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Pulse Animation (for live indicators) */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Glow Animation */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255,255,255,0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(255,255,255,0.8);
    }
}

/* Rotate Animation */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Bounce Animation */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
}

/* Wave Animation */
@keyframes wave {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-5px) rotate(-1deg);
    }
    50% {
        transform: translateY(0px) rotate(0deg);
    }
    75% {
        transform: translateY(-5px) rotate(1deg);
    }
}

/* Shimmer Loading Effect */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Color Transition */
@keyframes colorPulse {
    0%, 100% {
        color: #050505;
    }
    50% {
        color: #FFFFFF;
    }
}

/* ── REAL-TIME IMAGE CAROUSEL ──────────────────────────── */

.image-carousel {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
    background: var(--space-dark);
}

.carousel-container {
    display: flex;
    transition: transform 0.6s ease-in-out;
    width: 100%;
}

.carousel-item {
    flex: 0 0 100%;
    min-width: 100%;
    animation: fadeIn 0.8s ease-in;
}

.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Carousel Controls */
.carousel-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

.carousel-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.carousel-dot.active {
    background: var(--accent);
    transform: scale(1.3);
}

.carousel-dot:hover {
    background: rgba(255,255,255,0.8);
}

/* Carousel Buttons */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border: none;
    background: rgba(5,5,5,0.4);
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.3s ease;
    z-index: 10;
}

.carousel-btn:hover {
    background: rgba(5,5,5,0.7);
    transform: translateY(-50%) scale(1.1);
}

.carousel-btn.prev {
    left: 10px;
}

.carousel-btn.next {
    right: 10px;
}

/* ── REAL-TIME IMAGE GALLERY ───────────────────────────── */

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    aspect-ratio: 1;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(5,5,5,0.1);
    transition: transform 0.3s ease;
}

.gallery-item:hover {
    transform: scale(1.05);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

/* Gallery Overlay */
.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(5,5,5,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-overlay-content {
    color: white;
    text-align: center;
    animation: zoomIn 0.3s ease;
}

/* ── ANIMATED IMAGE REVEAL ──────────────────────────────── */

.image-reveal {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: var(--space-dark);
}

.image-reveal img {
    width: 100%;
    height: auto;
    display: block;
    animation: fadeIn 0.8s ease-in-out;
}

/* Reveal with Slide */
.reveal-slide img {
    animation: slideInLeft 0.8s ease-in-out;
}

/* Reveal with Zoom */
.reveal-zoom img {
    animation: zoomIn 0.8s ease-in-out;
}

/* ── LOADING PLACEHOLDERS ──────────────────────────────── */

.image-loading {
    background: linear-gradient(
        90deg,
        var(--space-dark) 25%,
        rgba(255,255,255,0.1) 50%,
        var(--space-dark) 75%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
    height: 200px;
    border-radius: 8px;
}

/* ── LIVE UPDATE BADGE ──────────────────────────────────── */

.live-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #E06030;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 5;
}

.live-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    animation: pulse 1s infinite;
}

/* ── ANIMATED CARDS WITH IMAGES ────────────────────────── */

.card-animate {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(5,5,5,0.08);
    transition: all 0.3s ease;
    animation: fadeIn 0.6s ease-out;
}

.card-animate:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(5,5,5,0.15);
}

.card-image-wrapper {
    position: relative;
    overflow: hidden;
    height: 200px;
    background: var(--space-dark);
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.card-animate:hover .card-image-wrapper img {
    transform: scale(1.1) rotate(2deg);
}

/* ── PARALLAX EFFECT ───────────────────────────────────── */

.parallax-image {
    position: relative;
    overflow: hidden;
    height: 400px;
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.parallax-image img {
    position: absolute;
    width: 100%;
    height: 120%;
    object-fit: cover;
    animation: slowZoom 20s ease-in-out infinite;
}

@keyframes slowZoom {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ── IMAGE COUNTER / LIVE STATS ────────────────────────── */

.image-counter {
    display: inline-block;
    background: var(--accent);
    color: #050505;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
}

.counter-number {
    animation: colorPulse 2s ease-in-out infinite;
}

/* ── ANIMATED IMAGE GRID ───────────────────────────────── */

.grid-animate {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.grid-item {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    animation: fadeIn 0.6s ease-out;
    animation-fill-mode: both;
}

.grid-item:nth-child(1) { animation-delay: 0.1s; }
.grid-item:nth-child(2) { animation-delay: 0.2s; }
.grid-item:nth-child(3) { animation-delay: 0.3s; }
.grid-item:nth-child(4) { animation-delay: 0.4s; }
.grid-item:nth-child(5) { animation-delay: 0.5s; }
.grid-item:nth-child(6) { animation-delay: 0.6s; }
.grid-item:nth-child(7) { animation-delay: 0.7s; }
.grid-item:nth-child(8) { animation-delay: 0.8s; }

.grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.grid-item:hover img {
    transform: scale(1.15) rotate(3deg);
}

/* ── REAL-TIME NOTIFICATION ANIMATION ───────────────────── */

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notification {
    animation: slideDown 0.4s ease-out;
}

/* ── IMAGE FADE TRANSITION ──────────────────────────────── */

.fade-transition {
    transition: opacity 0.6s ease-in-out;
}

.fade-transition.loading {
    opacity: 0.5;
}

.fade-transition.loaded {
    opacity: 1;
}

/* ── RESPONSIVE ANIMATIONS ──────────────────────────────── */

@media (max-width: 768px) {
    .carousel-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .parallax-image {
        background-attachment: scroll;
        height: 250px;
    }
    
    .grid-animate {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .image-gallery {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
}

/* ── PERFORMANCE OPTIMIZATIONS ────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── LAZY LOAD SKELETON ────────────────────────────────── */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--space-dark) 25%,
        rgba(255,255,255,0.2) 50%,
        var(--space-dark) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
    border-radius: 8px;
}

.skeleton-image {
    height: 300px;
    width: 100%;
}

.skeleton-text {
    height: 16px;
    width: 100%;
    margin: 10px 0;
}
