/* ===================================
   Robot Loading Animation - Antikythera Technologies
   Tokyo Night themed loading animations with robot icon
   =================================== */

/* ===================================
   Core Robot Loading Animation
   =================================== */

.robot-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 3rem 2rem;
    text-align: center;
    min-height: 200px;
}

.robot-loading--inline {
    min-height: auto;
    padding: 2rem 1rem;
}

.robot-loading--small {
    min-height: auto;
    padding: 1rem;
    gap: 1rem;
}

/* Robot Icon Container */
.robot-icon-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Robot Icon */
.robot-icon {
    width: 64px;
    height: 64px;
    opacity: 0.9;
    filter: drop-shadow(0 0 20px rgba(123, 162, 247, 0.3));
    animation: robotSpin 2s linear infinite;
}

.robot-icon--large {
    width: 80px;
    height: 80px;
}

.robot-icon--small {
    width: 40px;
    height: 40px;
}

.robot-icon--tiny {
    width: 24px;
    height: 24px;
}

/* Spinning Animation */
@keyframes robotSpin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Pulse Glow Effect */
.robot-icon-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    background: radial-gradient(
        circle,
        rgba(123, 162, 247, 0.2) 0%,
        rgba(123, 162, 247, 0.1) 30%,
        transparent 70%
    );
    border-radius: 50%;
    animation: robotPulse 2s ease-in-out infinite;
    z-index: -1;
}

@keyframes robotPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
}

/* Loading Text */
.robot-loading-text {
    font-size: 1.1rem;
    color: var(--text-secondary, #a9b1d6);
    font-weight: 500;
    margin: 0;
    animation: robotTextPulse 1.5s ease-in-out infinite;
}

.robot-loading-text--small {
    font-size: 0.9rem;
}

.robot-loading-text--large {
    font-size: 1.3rem;
}

@keyframes robotTextPulse {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

/* Loading Dots Animation */
.robot-loading-dots::after {
    content: '';
    animation: robotDots 1.5s infinite;
}

@keyframes robotDots {
    0%, 20% {
        content: '';
    }
    40% {
        content: '.';
    }
    60% {
        content: '..';
    }
    80%, 100% {
        content: '...';
    }
}

/* ===================================
   Specific Loading States
   =================================== */

/* Blog Grid Loading */
.blog-grid-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    padding: 4rem 2rem;
    background: rgba(26, 27, 38, 0.3);
    border-radius: var(--radius-lg, 12px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(123, 162, 247, 0.1);
}

/* Featured Post Loading */
.featured-post-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    padding: 3rem 2rem;
    background: rgba(26, 27, 38, 0.5);
    border-radius: var(--radius-lg, 12px);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(123, 162, 247, 0.2);
}

/* Post Content Loading */
.post-content-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    padding: 4rem 2rem;
    background: rgba(26, 27, 38, 0.4);
    border-radius: var(--radius-lg, 12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(123, 162, 247, 0.15);
}

/* Button Loading State */
.button-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.button-loading .robot-icon {
    width: 20px;
    height: 20px;
    margin-right: 0.5rem;
}

.button-loading .robot-icon-container::before {
    display: none; /* No glow for small button icons */
}

/* ===================================
   Overlay Loading
   =================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 27, 38, 0.8);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-overlay .robot-loading {
    background: rgba(26, 27, 38, 0.9);
    border-radius: var(--radius-xl, 16px);
    border: 1px solid rgba(123, 162, 247, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    min-width: 300px;
}

/* ===================================
   Skeleton Loading with Robot
   =================================== */

.skeleton-loading {
    position: relative;
    background: linear-gradient(
        90deg,
        rgba(26, 27, 38, 0.6) 0%,
        rgba(65, 72, 104, 0.4) 50%,
        rgba(26, 27, 38, 0.6) 100%
    );
    background-size: 200% 100%;
    animation: skeletonShimmer 2s infinite;
    border-radius: var(--radius-md, 8px);
}

@keyframes skeletonShimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    background-image: url('/blog/images/ai-robot-icon.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.3;
    animation: robotSpin 3s linear infinite;
}

/* ===================================
   Responsive Design
   =================================== */

@media (max-width: 768px) {
    .robot-loading {
        gap: 1rem;
        padding: 2rem 1rem;
        min-height: 150px;
    }
    
    .robot-icon {
        width: 48px;
        height: 48px;
    }
    
    .robot-icon--large {
        width: 56px;
        height: 56px;
    }
    
    .robot-loading-text {
        font-size: 1rem;
    }
    
    .blog-grid-loading {
        min-height: 300px;
        padding: 3rem 1rem;
    }
    
    .featured-post-loading {
        min-height: 200px;
        padding: 2rem 1rem;
    }
    
    .post-content-loading {
        min-height: 400px;
        padding: 3rem 1rem;
    }
    
    .loading-overlay .robot-loading {
        min-width: 280px;
        margin: 0 1rem;
    }
}

@media (max-width: 480px) {
    .robot-icon {
        width: 40px;
        height: 40px;
    }
    
    .robot-loading-text {
        font-size: 0.9rem;
    }
    
    .blog-grid-loading {
        min-height: 250px;
        padding: 2rem 1rem;
    }
    
    .featured-post-loading {
        min-height: 180px;
        padding: 1.5rem 1rem;
    }
    
    .post-content-loading {
        min-height: 300px;
        padding: 2rem 1rem;
    }
}

/* ===================================
   Theme Integration
   =================================== */

/* Tokyo Night color variations */
.robot-loading--blue .robot-icon {
    filter: drop-shadow(0 0 20px rgba(123, 162, 247, 0.4));
}

.robot-loading--purple .robot-icon {
    filter: drop-shadow(0 0 20px rgba(187, 154, 247, 0.4));
}

.robot-loading--cyan .robot-icon {
    filter: drop-shadow(0 0 20px rgba(125, 207, 255, 0.4));
}

.robot-loading--green .robot-icon {
    filter: drop-shadow(0 0 20px rgba(158, 206, 106, 0.4));
}

/* Success state */
.robot-loading--success .robot-icon {
    animation: robotSpin 0.5s ease-out, robotSuccess 0.5s ease-out 0.5s forwards;
    filter: drop-shadow(0 0 20px rgba(158, 206, 106, 0.6));
}

@keyframes robotSuccess {
    0% {
        transform: rotate(360deg) scale(1);
    }
    50% {
        transform: rotate(360deg) scale(1.2);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

/* Error state */
.robot-loading--error .robot-icon {
    animation: robotShake 0.5s ease-out;
    filter: drop-shadow(0 0 20px rgba(247, 118, 142, 0.6));
}

@keyframes robotShake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* ===================================
   Accessibility
   =================================== */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .robot-icon {
        animation: none;
    }
    
    .robot-icon-container::before {
        animation: none;
        opacity: 0.3;
    }
    
    .robot-loading-text {
        animation: none;
        opacity: 0.8;
    }
    
    .skeleton-loading {
        animation: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .robot-icon {
        filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.8));
    }
    
    .robot-loading-text {
        color: var(--text-primary, #c0caf5);
    }
}

/* ===================================
   Print Styles
   =================================== */

@media print {
    .robot-loading,
    .loading-overlay,
    .blog-grid-loading,
    .featured-post-loading,
    .post-content-loading {
        display: none;
    }
}