/**
 * BePeak SPA Skeleton Loading Styles
 * Matches actual BePeak design: Swiper sliders, Grid cards, Dark segments
 * 
 * @package BePeak
 * @version 2.0.0 - Tema tasarımına uygun
 */

/* ====================================
   SPA LOADING STATES
   ==================================== */

.spa-loading {
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* ====================================
   SKELETON BASE
   ==================================== */

.spa-skeleton {
    padding: 20px 0;
    animation: skeleton-fade-in 0.3s ease;
}

@keyframes skeleton-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Shimmer animation */
@keyframes skeleton-shimmer {
    0% {
        background-position: -468px 0;
    }
    100% {
        background-position: 468px 0;
    }
}

.skeleton-box {
    display: inline-block;
    height: 100%;
    width: 100%;
    background: linear-gradient(to right, #1a1d29 0%, #232631 20%, #1a1d29 40%, #1a1d29 100%);
    background-size: 800px 104px;
    animation: skeleton-shimmer 1.5s infinite linear;
    border-radius: 8px;
}

/* ====================================
   BEPEAK PAGE TITLE
   ==================================== */

.skeleton-page-title {
    height: 40px;
    width: 60%;
    max-width: 400px;
    margin: 20px 0 15px;
    background: linear-gradient(to right, #1a1d29 0%, #232631 20%, #1a1d29 40%, #1a1d29 100%);
    background-size: 800px 104px;
    animation: skeleton-shimmer 1.5s infinite linear;
    border-radius: 8px;
}

.skeleton-description {
    height: 20px;
    width: 80%;
    max-width: 600px;
    margin-bottom: 30px;
    background: linear-gradient(to right, #1a1d29 0%, #232631 20%, #1a1d29 40%, #1a1d29 100%);
    background-size: 800px 104px;
    animation: skeleton-shimmer 1.5s infinite linear;
    border-radius: 8px;
    opacity: 0.7;
}

/* ====================================
   DARK SEGMENT (BePeak style)
   ==================================== */

.skeleton-dark-segment {
    background: #14161f;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
}

.skeleton-segment-title {
    height: 28px;
    width: 200px;
    margin-bottom: 20px;
    background: linear-gradient(to right, #1a1d29 0%, #232631 20%, #1a1d29 40%, #1a1d29 100%);
    background-size: 800px 104px;
    animation: skeleton-shimmer 1.5s infinite linear;
    border-radius: 6px;
}

/* ====================================
   SWIPER SKELETON (Horizontal Slider)
   ==================================== */

.skeleton-swiper {
    display: flex;
    gap: 15px;
    overflow: hidden;
    margin-bottom: 20px;
}

.skeleton-swiper-item {
    flex: 0 0 auto;
    width: 200px;
}

.skeleton-swiper-poster {
    width: 200px;
    height: 300px;
    background: linear-gradient(to right, #1a1d29 0%, #232631 20%, #1a1d29 40%, #1a1d29 100%);
    background-size: 800px 104px;
    animation: skeleton-shimmer 1.5s infinite linear;
    border-radius: 8px;
    margin-bottom: 10px;
}

.skeleton-swiper-title {
    height: 20px;
    width: 180px;
    background: linear-gradient(to right, #1a1d29 0%, #232631 20%, #1a1d29 40%, #1a1d29 100%);
    background-size: 800px 104px;
    animation: skeleton-shimmer 1.5s infinite linear;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-swiper-meta {
    height: 16px;
    width: 140px;
    background: linear-gradient(to right, #1a1d29 0%, #232631 20%, #1a1d29 40%, #1a1d29 100%);
    background-size: 800px 104px;
    animation: skeleton-shimmer 1.5s infinite linear;
    border-radius: 4px;
    opacity: 0.6;
}

/* ====================================
   GRID SKELETON (Movies/Series Grid)
   ==================================== */

.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.skeleton-grid-item {
    position: relative;
}

.skeleton-grid-poster {
    width: 100%;
    padding-bottom: 150%; /* 2:3 aspect ratio */
    background: linear-gradient(to right, #1a1d29 0%, #232631 20%, #1a1d29 40%, #1a1d29 100%);
    background-size: 800px 104px;
    animation: skeleton-shimmer 1.5s infinite linear;
    border-radius: 8px;
    margin-bottom: 10px;
}

.skeleton-grid-title {
    height: 20px;
    width: 90%;
    background: linear-gradient(to right, #1a1d29 0%, #232631 20%, #1a1d29 40%, #1a1d29 100%);
    background-size: 800px 104px;
    animation: skeleton-shimmer 1.5s infinite linear;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-grid-meta {
    height: 16px;
    width: 70%;
    background: linear-gradient(to right, #1a1d29 0%, #232631 20%, #1a1d29 40%, #1a1d29 100%);
    background-size: 800px 104px;
    animation: skeleton-shimmer 1.5s infinite linear;
    border-radius: 4px;
    opacity: 0.6;
}

/* ====================================
   MODULE SKELETON (Featured/New Episodes)
   ==================================== */

.skeleton-module {
    background: #14161f;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    gap: 20px;
    align-items: center;
}

.skeleton-module-image {
    width: 400px;
    height: 230px;
    flex-shrink: 0;
    background: linear-gradient(to right, #1a1d29 0%, #232631 20%, #1a1d29 40%, #1a1d29 100%);
    background-size: 800px 104px;
    animation: skeleton-shimmer 1.5s infinite linear;
    border-radius: 8px;
}

.skeleton-module-content {
    flex: 1;
}

.skeleton-module-title {
    height: 32px;
    width: 70%;
    margin-bottom: 15px;
    background: linear-gradient(to right, #1a1d29 0%, #232631 20%, #1a1d29 40%, #1a1d29 100%);
    background-size: 800px 104px;
    animation: skeleton-shimmer 1.5s infinite linear;
    border-radius: 6px;
}

.skeleton-module-episode {
    height: 20px;
    width: 40%;
    margin-bottom: 15px;
    background: linear-gradient(to right, #1a1d29 0%, #232631 20%, #1a1d29 40%, #1a1d29 100%);
    background-size: 800px 104px;
    animation: skeleton-shimmer 1.5s infinite linear;
    border-radius: 4px;
    opacity: 0.7;
}

.skeleton-module-text {
    height: 16px;
    width: 90%;
    margin-bottom: 8px;
    background: linear-gradient(to right, #1a1d29 0%, #232631 20%, #1a1d29 40%, #1a1d29 100%);
    background-size: 800px 104px;
    animation: skeleton-shimmer 1.5s infinite linear;
    border-radius: 4px;
    opacity: 0.5;
}

.skeleton-module-button {
    height: 40px;
    width: 150px;
    margin-top: 20px;
    background: linear-gradient(to right, #1a1d29 0%, #232631 20%, #1a1d29 40%, #1a1d29 100%);
    background-size: 800px 104px;
    animation: skeleton-shimmer 1.5s infinite linear;
    border-radius: 8px;
}

/* ====================================
   RESPONSIVE
   ==================================== */

@media (max-width: 768px) {
    .skeleton-swiper-item {
        width: 150px;
    }
    
    .skeleton-swiper-poster {
        width: 150px;
        height: 225px;
    }
    
    .skeleton-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .skeleton-module {
        flex-direction: column;
    }
    
    .skeleton-module-image {
        width: 100%;
        height: 200px;
    }
}

/* ====================================
   LEGACY (Old generic skeleton - keep for compatibility)
   ==================================== */

.skeleton-header {
    margin-bottom: 30px;
}

.skeleton-title {
    height: 40px;
    width: 70%;
    background: linear-gradient(90deg, #2a2d3a 0%, #35384a 50%, #2a2d3a 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
    margin-bottom: 15px;
}

.skeleton-subtitle {
    height: 24px;
    width: 50%;
    background: linear-gradient(90deg, #2a2d3a 0%, #35384a 50%, #2a2d3a 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite 0.2s;
    border-radius: 6px;
}

/* ====================================
   SKELETON CONTENT
   ==================================== */

.skeleton-content {
    padding: 20px 0;
}

.skeleton-line {
    height: 16px;
    background: linear-gradient(90deg, #2a2d3a 0%, #35384a 50%, #2a2d3a 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 14px;
}

.skeleton-line:nth-child(1) { animation-delay: 0s; width: 100%; }
.skeleton-line:nth-child(2) { animation-delay: 0.1s; width: 95%; }
.skeleton-line:nth-child(3) { animation-delay: 0.2s; width: 100%; }
.skeleton-line:nth-child(4) { animation-delay: 0.3s; width: 70%; }
.skeleton-line:nth-child(5) { animation-delay: 0.4s; width: 100%; }
.skeleton-line:nth-child(6) { animation-delay: 0.5s; width: 65%; }

.skeleton-line.short {
    width: 60%;
}

/* ====================================
   SKELETON FOOTER
   ==================================== */

.skeleton-footer {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.skeleton-button {
    height: 44px;
    width: 120px;
    background: linear-gradient(90deg, #2a2d3a 0%, #35384a 50%, #2a2d3a 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 6px;
}

/* ====================================
   SKELETON LOADING ANIMATION
   ==================================== */

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ====================================
   SMOOTH TRANSITIONS
   ==================================== */

#main-content {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#main-content.spa-loading {
    transform: scale(0.98);
}

/* ====================================
   MOBILE RESPONSIVE
   ==================================== */

@media (max-width: 768px) {
    .spa-skeleton {
        padding: 20px;
    }
    
    .skeleton-title {
        height: 32px;
        width: 90%;
    }
    
    .skeleton-subtitle {
        height: 20px;
        width: 70%;
    }
    
    .skeleton-footer {
        flex-direction: column;
    }
    
    .skeleton-button {
        width: 100%;
    }
}

/* ====================================
   ALTERNATIVE STYLES (VARIANTS)
   ==================================== */

/* Light theme skeleton */
body.light-mode .spa-skeleton {
    background: #f5f5f5;
}

body.light-mode .skeleton-title,
body.light-mode .skeleton-subtitle,
body.light-mode .skeleton-line,
body.light-mode .skeleton-button {
    background: linear-gradient(90deg, #e0e0e0 0%, #ececec 50%, #e0e0e0 100%);
    background-size: 200% 100%;
}

/* ====================================
   ACCESSIBILITY
   ==================================== */

.spa-skeleton[aria-hidden="true"] {
    display: none;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .spa-skeleton,
    .skeleton-title,
    .skeleton-subtitle,
    .skeleton-line,
    .skeleton-button,
    #main-content {
        animation: none !important;
        transition: none !important;
    }
}

/* ====================================
   UTILITIES
   ==================================== */

.spa-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: fade-in 0.2s ease;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.spa-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

