/* ============================================
   HERO SLIDER - مع Popover للمشاركة
   الإصدار: 2.3.0 - مع دعم 2K و 4K
   ============================================ */

/* ============================================
   دعم WebP وتحسين جودة الصور
   ============================================ */

/* تحسين جودة الصور للشاشات عالية الدقة */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .slide-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* تحسينات خاصة لشاشات 2K و 4K */
@media (min-width: 1920px) {
    .slide-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
        -ms-interpolation-mode: bicubic;
    }
}

@media (min-width: 2560px) {
    .slide-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: high-quality;
    }
}

/* منع تشويش الصور */
.slide-image {
    -webkit-backface-visibility: hidden;
    -ms-transform: translateZ(0);
    transform: translateZ(0);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    -ms-interpolation-mode: bicubic;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.hero-slider {
    width: 100%;
    height: 80vh;
    min-height: 600px;
    max-height: 800px;
    position: relative;
    overflow: hidden;
    background: #0a0a0a;
    direction: ltr;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hero-slider.ready {
    opacity: 1;
}

.hero-slider .heroSwiper {
    width: 100%;
    height: 100%;
}

.hero-slider .swiper-slide {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
    background: transparent;
}

/* Background Image */
.slide-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    aspect-ratio: 16/9;
    background: #0a0a0a;
}

.slide-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 25%;
    display: block;
    transition: transform 5s ease;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    -ms-interpolation-mode: bicubic;
    backface-visibility: hidden;
    transform: translateZ(0);
    opacity: 0;
    animation: imageFadeIn 0.5s ease forwards;
    will-change: transform, opacity;
    content-visibility: auto;
    contain-intrinsic-size: 1920px 800px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.hero-slider .swiper-slide-active .slide-image {
    transform: scale(1.05);
}

.slide-image.loaded {
    opacity: 1;
}

@keyframes imageFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Overlay */
.slide-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        rgba(0,0,0,0.9) 0%, 
        rgba(0,0,0,0.6) 30%, 
        rgba(0,0,0,0.3) 60%,
        transparent 100%
    );
    z-index: 1;
    pointer-events: none;
}

/* Content Container */
.slide-content {
    position: relative;
    z-index: 2;
    max-width: 650px;
    margin-left: 8%;
    color: #fff;
    animation: slideContentFadeIn 1s ease-out;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@keyframes slideContentFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.movie-title-hero {
    font-size: 72px;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 0;
    text-transform: uppercase;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    letter-spacing: -1px;
    color: #fff;
    font-family: 'Arial Black', sans-serif;
}

.movie-meta {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 0;
}

.movie-meta span {
    font-size: 16px;
    font-weight: 500;
}

.movie-meta .year {
    color: #e50914;
    font-weight: 700;
    background: rgba(229, 9, 20, 0.2);
    padding: 4px 10px;
    border-radius: 4px;
    border-left: 3px solid #e50914;
}

.movie-meta .quality {
    background: rgba(255,255,255,0.15);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 14px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.1);
    text-transform: uppercase;
}

.movie-meta .rating {
    background: rgba(255,193,7,0.15);
    padding: 4px 10px;
    border-radius: 4px;
    border-left: 3px solid #ffc107;
}

.movie-meta .rating i {
    color: #ffc107;
    margin-right: 5px;
}

.movie-description {
    font-size: 18px;
    line-height: 1.6;
    color: rgba(255,255,255,0.95);
    max-width: 550px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    font-weight: 400;
    margin-bottom: 5px;
}

/* ===== Buttons ===== */
.slide-buttons {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 5px;
}

.play-btn-hero {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #e50914;
    color: white;
    padding: 16px 45px;
    border-radius: 50px;
    font-size: 20px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 0 25px rgba(229, 9, 20, 0.5);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.play-btn-hero i {
    font-size: 22px;
}

.play-btn-hero:hover {
    background: #ff0a16;
    transform: scale(1.05);
    box-shadow: 0 0 35px rgba(229, 9, 20, 0.8);
}

.trailer-btn-hero {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    color: white;
    padding: 16px 45px;
    border-radius: 50px;
    font-size: 20px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 2px solid rgba(255,255,255,0.3);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.trailer-btn-hero i {
    font-size: 22px;
}

.trailer-btn-hero:hover {
    background: rgba(255,255,255,0.3);
    border-color: white;
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(255,255,255,0.3);
}

/* ===== Share Wrapper and Popover ===== */
.share-wrapper {
    position: relative;
    display: inline-block;
}

.share-btn-hero {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(10px);
    color: white;
    padding: 16px 45px;
    border-radius: 50px;
    font-size: 20px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 2px solid rgba(255,255,255,0.2);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.share-btn-hero i {
    font-size: 22px;
}

.share-btn-hero:hover {
    background: rgba(229, 9, 20, 0.8);
    border-color: white;
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(229, 9, 20, 0.3);
}

.share-btn-hero[aria-expanded="true"] {
    background: rgba(229, 9, 20, 0.9);
    border-color: white;
}

/* Popover */
.share-popover {
    position: absolute;
    bottom: calc(100% + 15px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #1a1a1a;
    border-radius: 12px;
    padding: 15px;
    min-width: 280px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
}

.share-popover.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: all;
}

/* Popover Arrow */
.share-popover-arrow {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 16px;
    height: 16px;
    background: #1a1a1a;
    border-right: 1px solid rgba(255,255,255,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    z-index: -1;
}

/* Popover Content */
.share-popover-content {
    color: white;
}

.share-popover-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: rgba(255,255,255,0.9);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.share-popover-url {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    background: #2a2a2a;
    border-radius: 8px;
    padding: 4px;
}

.share-popover-input {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: white;
    font-size: 12px;
    outline: none;
}

.share-popover-copy {
    background: #e50914;
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-popover-copy:hover {
    background: #ff0a16;
    transform: scale(1.05);
}

.share-popover-copy i {
    font-size: 16px;
}

.share-popover-social {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 18px;
}

.social-icon:hover {
    transform: translateY(-3px) scale(1.1);
}

.social-icon.facebook { background: #3b5998; }
.social-icon.twitter { background: #1da1f2; }
.social-icon.whatsapp { background: #25d366; }
.social-icon.telegram { background: #0088cc; }

/* Navigation Buttons */
.hero-next,
.hero-prev {
    background: rgba(0,0,0,0.6) !important;
    backdrop-filter: blur(5px);
    width: 50px !important;
    height: 50px !important;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2) !important;
    transition: all 0.3s ease;
    z-index: 10;
}

.hero-next:hover,
.hero-prev:hover {
    background: #e50914 !important;
    border-color: white !important;
    transform: scale(1.1);
}

.hero-next:after,
.hero-prev:after {
    display: none;
}

.hero-next i,
.hero-prev i {
    color: white;
    font-size: 22px;
}

.hero-next {
    right: 20px;
}

.hero-prev {
    left: 20px;
}

/* Pagination */
.hero-pagination {
    bottom: 30px !important;
    z-index: 10;
}

.hero-pagination .swiper-pagination-bullet {
    width: 12px;
    height: 12px;
    background: rgba(255,255,255,0.4);
    opacity: 1;
    margin: 0 6px !important;
    transition: all 0.3s ease;
}

.hero-pagination .swiper-pagination-bullet-active {
    background: #e50914;
    width: 35px;
    border-radius: 10px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background-color: #1a1a1a;
    margin: 5% auto;
    padding: 0;
    width: 80%;
    max-width: 900px;
    border-radius: 15px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.5);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 15px 25px;
    background: linear-gradient(90deg, #e50914, #ff0a16);
    color: white;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.close-modal {
    background: transparent;
    border: none;
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0 10px;
}

.close-modal:hover {
    transform: scale(1.2);
}

.modal-body {
    padding: 25px;
}

.trailer-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 10px;
}

.trailer-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ============================================
   RESPONSIVE DESIGN - للهاتف والتابليت فقط
   ============================================ */

/* للتابليت */
@media (max-width: 768px) {
    .hero-slider {
        height: 55vh;
        min-height: 400px;
        max-height: 550px;
    }
    
    .hero-slider.ready {
        height: 55vh !important;
        min-height: 400px !important;
    }
    
    .slide-content {
        max-width: 85%;
        margin-left: 5%;
        margin-right: 5%;
        margin-top: 8vh;
    }
    
    .movie-title-hero {
        font-size: 46px;
    }
    
    .movie-description {
        font-size: 15px;
        max-width: 100%;
    }
    
    /* ===== الأزرار في التابليت ===== */
    .slide-buttons {
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        gap: 12px;
    }
    
    .play-btn-hero,
    .trailer-btn-hero,
    .share-btn-hero {
        padding: 10px 25px;
        font-size: 15px;
        min-width: 120px;
        width: auto;
    }
    
    .play-btn-hero i,
    .trailer-btn-hero i,
    .share-btn-hero i {
        font-size: 16px;
    }
    
    .share-popover {
        min-width: 250px;
    }
}

/* للهاتف */
@media (max-width: 576px) {
    .hero-slider {
        height: 45vh;
        min-height: 350px;
        max-height: 450px;
    }
    
    .hero-slider.ready {
        height: 45vh !important;
        min-height: 350px !important;
    }
    
    .slide-content {
        max-width: 85%;
        margin-left: 5%;
        margin-right: 5%;
        margin-top: 5vh;
    }
    
    .movie-title-hero {
        font-size: 32px;
        line-height: 1.2;
    }
    
    .movie-meta span {
        font-size: 11px;
        padding: 3px 8px;
    }
    
    .movie-description {
        font-size: 13px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* ===== الأزرار في الهاتف ===== */
    .slide-buttons {
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .play-btn-hero,
    .trailer-btn-hero,
    .share-btn-hero {
        padding: 6px 15px;
        font-size: 13px;
        min-width: 90px;
        width: auto;
    }
    
    .play-btn-hero i,
    .trailer-btn-hero i,
    .share-btn-hero i {
        font-size: 13px;
        margin-right: 4px;
    }
    
    .play-btn-hero span,
    .trailer-btn-hero span,
    .share-btn-hero span {
        display: inline;
    }
    
    /* إخفاء أزرار التنقل الجانبية */
    .hero-next,
    .hero-prev {
        display: none !important;
    }
    
    /* إظهار الباجينيشن (النقاط) */
    .hero-pagination {
        bottom: 10px !important;
    }
    
    .hero-pagination .swiper-pagination-bullet {
        width: 6px;
        height: 6px;
        margin: 0 3px !important;
    }
    
    .hero-pagination .swiper-pagination-bullet-active {
        width: 18px;
    }
    
    /* تعديل الـ Popover للهاتف */
    .share-popover {
        position: fixed;
        bottom: auto;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0.9);
        width: 90%;
        min-width: auto;
        max-width: 280px;
        padding: 12px;
    }
    
    .share-popover.active {
        transform: translate(-50%, -50%) scale(1);
    }
    
    .share-popover-arrow {
        display: none;
    }
    
    .social-icon {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
}

/* للهواتف الصغيرة جداً */
@media (max-width: 375px) {
    .hero-slider {
        height: 40vh;
        min-height: 300px;
        max-height: 400px;
    }
    
    .hero-slider.ready {
        height: 40vh !important;
        min-height: 300px !important;
    }
    
    .movie-title-hero {
        font-size: 26px;
    }
    
    .movie-description {
        font-size: 11px;
        -webkit-line-clamp: 1;
    }
    
    .slide-content {
        margin-top: 4vh;
        gap: 6px;
    }
    
    /* ===== الأزرار في الهواتف الصغيرة ===== */
    .play-btn-hero,
    .trailer-btn-hero,
    .share-btn-hero {
        padding: 6px 12px;
        min-width: 70px;
        font-size: 12px;
    }
    
    .play-btn-hero span,
    .trailer-btn-hero span,
    .share-btn-hero span {
        display: none;
    }
    
    .play-btn-hero i,
    .trailer-btn-hero i,
    .share-btn-hero i {
        font-size: 16px;
        margin-right: 0;
    }
}

/* ============================================
   تحسينات خاصة لشاشات 2K و 4K
   ============================================ */

/* لشاشات 2K (2560x1440) */
@media (min-width: 1920px) and (max-width: 2559px) {
    .hero-slider {
        height: 85vh;
        max-height: 900px;
    }
    
    .movie-title-hero {
        font-size: 80px;
    }
    
    .slide-content {
        max-width: 750px;
    }
}

/* لشاشات 4K (3840x2160 وما فوق) */
@media (min-width: 2560px) {
    .hero-slider {
        height: 90vh;
        max-height: 1000px;
    }
    
    .movie-title-hero {
        font-size: 96px;
    }
    
    .slide-content {
        max-width: 850px;
    }
    
    .play-btn-hero,
    .trailer-btn-hero,
    .share-btn-hero {
        padding: 20px 55px;
        font-size: 24px;
    }
    
    .play-btn-hero i,
    .trailer-btn-hero i,
    .share-btn-hero i {
        font-size: 26px;
    }
}

/* Accessibility */
button:focus-visible,
a:focus-visible {
    outline: 3px solid #e50914;
    outline-offset: 2px;
}

.modal[aria-hidden="true"] {
    display: none;
}

.modal[aria-hidden="false"] {
    display: block;
}