/**
 * StreamBox Skeleton Loading System
 * 
 * Premium skeleton placeholders for content loading states
 * Maintains layout stability and provides visual feedback
 * 
 * @package StreamBox
 * @since 1.0.0
 */

/* ===============================================
   BASE SKELETON STYLES
   =============================================== */

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(30, 41, 59, 0.4) 0%,
        rgba(51, 65, 85, 0.6) 50%,
        rgba(30, 41, 59, 0.4) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 0.5rem;
    position: relative;
    overflow: hidden;
}

.skeleton::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.05) 50%,
        transparent 100%
    );
    animation: skeleton-shine 1.5s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

@keyframes skeleton-shine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Hide skeleton when content is loaded */
.has-content .skeleton {
    display: none;
}

/* ===============================================
   HERO SECTION SKELETON
   =============================================== */

.hero-cinematic.skeleton-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 100%);
    position: relative;
}

.hero-skeleton {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 3rem;
}

.hero-skeleton__content {
    max-width: 700px;
}

.hero-skeleton__genres {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.hero-skeleton__genre {
    width: 80px;
    height: 28px;
    border-radius: 20px;
}

.hero-skeleton__title {
    width: 90%;
    max-width: 600px;
    height: 80px;
    margin-bottom: 1.5rem;
    border-radius: 0.75rem;
}

.hero-skeleton__meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.hero-skeleton__meta-item {
    width: 60px;
    height: 24px;
    border-radius: 0.5rem;
}

.hero-skeleton__description {
    margin-bottom: 2rem;
}

.hero-skeleton__desc-line {
    height: 20px;
    margin-bottom: 0.75rem;
    border-radius: 0.5rem;
}

.hero-skeleton__desc-line:nth-child(1) {
    width: 100%;
}

.hero-skeleton__desc-line:nth-child(2) {
    width: 95%;
}

.hero-skeleton__desc-line:nth-child(3) {
    width: 75%;
}

.hero-skeleton__actions {
    display: flex;
    gap: 1rem;
}

.hero-skeleton__button {
    width: 150px;
    height: 56px;
    border-radius: 0.5rem;
}

/* ===============================================
   CONTENT ROW SKELETON
   =============================================== */

.content-row.skeleton-wrapper {
    margin-bottom: 4rem;
}

.content-row-skeleton__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 3rem 1.5rem;
    margin-bottom: 1rem;
}

.content-row-skeleton__title {
    width: 220px;
    height: 36px;
    border-radius: 0.5rem;
}

.content-row-skeleton__link {
    width: 100px;
    height: 28px;
    border-radius: 0.5rem;
}

/* ===============================================
   CAROUSEL SKELETON
   =============================================== */

.carousel-skeleton {
    padding: 0 3rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.carousel-skeleton__item {
    aspect-ratio: 2/3;
    border-radius: 0.75rem;
}

/* Responsive carousel skeleton */
@media (min-width: 1400px) {
    .carousel-skeleton {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (min-width: 1024px) and (max-width: 1399px) {
    .carousel-skeleton {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .carousel-skeleton {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (min-width: 640px) and (max-width: 767px) {
    .carousel-skeleton {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 639px) {
    .carousel-skeleton {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .carousel-skeleton__item:nth-child(n+9) {
        display: none;
    }
}

/* ===============================================
   CONTENT CARD SKELETON
   =============================================== */

.card-skeleton {
    display: flex;
    flex-direction: column;
    border-radius: 0.75rem;
    overflow: hidden;
}

.card-skeleton__poster {
    aspect-ratio: 2/3;
    width: 100%;
    border-radius: 0.75rem 0.75rem 0 0;
}

.card-skeleton__content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.card-skeleton__title {
    height: 24px;
    width: 85%;
    border-radius: 0.5rem;
}

.card-skeleton__meta {
    display: flex;
    gap: 0.75rem;
}

.card-skeleton__meta-item {
    height: 18px;
    width: 50px;
    border-radius: 0.5rem;
}

/* ===============================================
   GRID SKELETON (for archive pages)
   =============================================== */

.grid-skeleton {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 2rem;
    padding: 2rem;
}

.grid-skeleton__item {
    aspect-ratio: 2/3;
    border-radius: 0.75rem;
}

@media (max-width: 768px) {
    .grid-skeleton {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
        padding: 1rem;
    }
}

/* ===============================================
   AD SKELETON STYLES
   =============================================== */

.skeleton-ad {
    position: relative;
    margin: 2rem auto;
    text-align: center;
}

.skeleton-ad .ad-content {
    background: linear-gradient(
        90deg,
        rgba(30, 41, 59, 0.3) 0%,
        rgba(51, 65, 85, 0.5) 50%,
        rgba(30, 41, 59, 0.3) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
}

.skeleton-ad .ad-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.03) 50%,
        transparent 100%
    );
    animation: skeleton-shine 1.5s ease-in-out infinite;
}

/* Specific ad zone skeleton sizes */
.skeleton-ad.ad-zone-header_banner .ad-content,
.skeleton-ad.ad-zone-footer_banner .ad-content {
    min-height: 90px;
    max-width: 728px;
    margin: 0 auto;
}

.skeleton-ad.ad-zone-sidebar_top .ad-content {
    min-height: 250px;
    max-width: 300px;
}

.skeleton-ad.ad-zone-sidebar_middle .ad-content {
    min-height: 600px;
    max-width: 300px;
}

.skeleton-ad.ad-zone-content_top .ad-content,
.skeleton-ad.ad-zone-content_bottom .ad-content {
    min-height: 90px;
    max-width: 970px;
    margin: 0 auto;
}

.skeleton-ad.ad-zone-content_middle .ad-content {
    min-height: 280px;
    max-width: 336px;
}

.skeleton-ad.ad-zone-between_posts .ad-content {
    min-height: 250px;
    max-width: 300px;
}

/* Ad skeleton placeholder icon */
.skeleton-ad-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    opacity: 0.2;
}

@media (max-width: 768px) {
    .skeleton-ad.ad-zone-header_banner .ad-content,
    .skeleton-ad.ad-zone-content_top .ad-content,
    .skeleton-ad.ad-zone-content_bottom .ad-content,
    .skeleton-ad.ad-zone-footer_banner .ad-content {
        min-height: 50px;
        max-width: 100%;
    }
}

/* ===============================================
   UTILITY CLASSES
   =============================================== */

/* Text line skeletons */
.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-text--title {
    height: 2em;
    width: 60%;
}

.skeleton-text--heading {
    height: 1.5em;
    width: 40%;
}

.skeleton-text--paragraph {
    height: 1em;
}

.skeleton-text--short {
    width: 30%;
}

.skeleton-text--medium {
    width: 60%;
}

.skeleton-text--long {
    width: 90%;
}

/* Button skeleton */
.skeleton-button {
    width: 120px;
    height: 44px;
    border-radius: 0.5rem;
}

/* Image skeleton */
.skeleton-image {
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    border-radius: 0.5rem;
}

.skeleton-image--square {
    padding-bottom: 100%;
}

.skeleton-image--portrait {
    padding-bottom: 150%; /* 2:3 aspect ratio */
}

/* Badge skeleton */
.skeleton-badge {
    width: 60px;
    height: 24px;
    border-radius: 12px;
}

/* Avatar skeleton */
.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

/* ===============================================
   ACCESSIBILITY & PERFORMANCE
   =============================================== */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .skeleton,
    .skeleton::after {
        animation: none;
    }
    
    .skeleton {
        background: rgba(30, 41, 59, 0.5);
    }
}

/* Print styles */
@media print {
    .skeleton,
    .skeleton-wrapper {
        display: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .skeleton {
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.3);
    }
}
