/* تنسيقات فيديوهات البورتفوليو */

.video-container {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 250px;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.video-container iframe {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.video-container:hover .video-overlay {
    opacity: 1;
}

.video-container:hover video,
.video-container:hover iframe {
    transform: scale(1.05);
}

.video-indicator {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #666;
    margin-top: 8px;
}

.video-indicator i {
    margin-right: 5px;
    color: #ff6b6b;
}

/* تنسيقات خاصة بفيديوهات ريلز */
.reels-video {
    aspect-ratio: 9/16;
    max-height: 400px;
}

.reels-video video {
    object-fit: cover;
}

/* تنسيقات خاصة بفيديوهات يوتيوب */
.youtube-video {
    aspect-ratio: 16/9;
}

/* تنسيقات خاصة بفيديوهات فيمو */
.vimeo-video {
    aspect-ratio: 16/9;
}

/* تحسينات للعرض على الأجهزة المحمولة */
@media (max-width: 768px) {
    .video-container {
        min-height: 200px;
    }
    
    .reels-video {
        max-height: 300px;
    }
}

/* تأثيرات إضافية للتفاعل */
.portfolio-item:hover .video-container {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* تنسيقات للتحكم في الفيديو */
.video-container video::-webkit-media-controls {
    background: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
}

.video-container video::-webkit-media-controls-panel {
    padding: 10px;
}

/* مؤشر تحميل الفيديو */
.video-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #ff6b6b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-container.loading::before {
    opacity: 1;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* تنسيقات للفلاتر */
.portfolio-filters .video-filter {
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    margin: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.portfolio-filters .video-filter:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.portfolio-filters .video-filter.active {
    background: linear-gradient(135deg, #ff4757, #ff3742);
    box-shadow: 0 2px 10px rgba(255, 71, 87, 0.4);
}

/* تنسيقات إضافية للفيديوهات */
.reels-controls {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.reels-video:hover .reels-controls {
    opacity: 1;
}

.reels-controls button {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reels-controls button:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.video-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 107, 107, 0.9);
    color: white;
    padding: 5px 8px;
    border-radius: 15px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.video-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 0, 0, 0.8);
    color: white;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
}

/* تحسينات للكاروسيل */
.portfolio-carousel .video-container {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.portfolio-carousel .video-container:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

/* تنسيقات للفلاتر */
.portfolio-filters {
    margin-bottom: 30px;
    text-align: center;
}

.portfolio-filters button {
    margin: 5px;
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    background: #f8f9fa;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
}

.portfolio-filters button:hover,
.portfolio-filters button.active {
    background: #007bff;
    color: white;
    transform: translateY(-2px);
}

/* تحسينات للعرض على الشاشات الكبيرة */
@media (min-width: 1200px) {
    .video-container {
        min-height: 300px;
    }
    
    .reels-video {
        max-height: 500px;
    }
}

/* تأثيرات بصرية إضافية */
.portfolio-item {
    transition: all 0.3s ease;
}

.portfolio-item:hover {
    transform: translateY(-5px);
}

.portfolio-item:hover .video-container {
    transform: scale(1.02);
}

/* تنسيقات للفيديوهات في البوب أب */
.popup-item .video-container {
    max-width: 90vw;
    max-height: 90vh;
}

.popup-item .video-container video,
.popup-item .video-container iframe {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* تحسينات للأداء */
.video-container video[preload="none"] {
    background: #000;
}

.video-container video[preload="none"]::after {
    content: 'انقر للتحميل';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 15px;
    border-radius: 20px;
    cursor: pointer;
}

/* إصلاح مشاكل العرض */
.pi-img {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.portfolio-item .video-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.portfolio-item .pi-img {
    background: #f0f0f0;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* تأكد من ظهور الفيديوهات */
.video-container video,
.video-container iframe {
    z-index: 1;
    position: relative;
}

.video-error {
    background: #ff4444;
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.video-error p {
    margin: 0;
    font-size: 14px;
}

/* تنسيقات خاصة للبورتفوليو */
.portfolio-item.has-video .pi-img {
    background: #000;
}

.portfolio-item[data-video-type] .pi-img::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    z-index: 0;
}

/* Animate.css - للحركات والتأثيرات */

.fadeIn {
    animation-name: fadeIn;
    animation-duration: 0.5s;
    animation-fill-mode: both;
}

.fadeOut {
    animation-name: fadeOut;
    animation-duration: 0.5s;
    animation-fill-mode: both;
}

.slideInUp {
    animation-name: slideInUp;
    animation-duration: 0.6s;
    animation-fill-mode: both;
}

.zoomIn {
    animation-name: zoomIn;
    animation-duration: 0.4s;
    animation-fill-mode: both;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes slideInUp {
    from {
        transform: translate3d(0, 100%, 0);
        visibility: visible;
    }
    to {
        transform: translate3d(0, 0, 0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale3d(0.3, 0.3, 0.3);
    }
    50% {
        opacity: 1;
    }
}

/* Animation utilities */
.animated {
    animation-duration: 1s;
    animation-fill-mode: both;
}

.infinite {
    animation-iteration-count: infinite;
}

.delay-1s {
    animation-delay: 1s;
}

.delay-2s {
    animation-delay: 2s;
}

.faster {
    animation-duration: 0.5s;
}

.slower {
    animation-duration: 2s;
}

/* تنسيقات خاصة بفيديوهات الكاروسيل */
.portfolio-carousel-item.has-video .a-img {
    background: #000;
    overflow: hidden;
    height: 150vh !important;
    margin: 0 auto;
    aspect-ratio: 9/16;
}

.portfolio-carousel-item .video-container {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 0;
}

.portfolio-carousel-item .video-container video,
.portfolio-carousel-item .video-container iframe {
    border-radius: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.carousel-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 107, 107, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 5px;
}

.carousel-indicator {
    display: flex;
    align-items: center;
    font-size: 13px;
    color: #666;
    margin-top: 10px;
    padding: 5px 0;
}

.carousel-indicator i {
    margin-right: 5px;
    color: #ff6b6b;
}

/* تحسينات للكاروسيل */
.portfolio-carousel .has-video .a-img div {
    display: none;
}

.portfolio-carousel .video-container {
    min-height: 150vh;
}

.portfolio-carousel .reels-video {
    max-height: 150vh;
}

/* تأثيرات خاصة بالكاروسيل */
.portfolio-carousel-item:hover .carousel-badge {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.portfolio-carousel .owl-item.current .video-container video {
    border: 2px solid #ffd700;
}

.portfolio-carousel .owl-item:not(.current) .video-container {
    opacity: 0.7;
}

.portfolio-carousel .owl-item:not(.current) .video-container video {
    pointer-events: none;
}

/* تحسينات للتنقل */
.portfolio-carousel .owl-nav .owl-prev,
.portfolio-carousel .owl-nav .owl-next {
    background: rgba(255, 215, 0, 0.9) !important;
    color: #000 !important;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
}

.portfolio-carousel .owl-nav .owl-prev:hover,
.portfolio-carousel .owl-nav .owl-next:hover {
    background: rgba(255, 215, 0, 1) !important;
    transform: scale(1.1);
}

/* CSS للفيديو في projects-scroll-block */
.projects-scroll-block .item.has-video .img {
  position: relative;
  overflow: hidden;
}

.projects-scroll-block .video-container {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 300px;
}

.projects-scroll-block .video-container video,
.projects-scroll-block .video-container iframe {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.projects-scroll-block .video-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.projects-scroll-block .video-badge i {
  color: #ff6b6b;
  font-size: 14px;
}



/* جميع الفيديوهات بنفس قياس كارتات الصور مع نسبة ريلز */
.projects-scroll-block .video-container,
.projects-scroll-block .reels-video,
.projects-scroll-block .youtube-video,
.projects-scroll-block .vimeo-video {
  width: 100%;
  height: 100%;
  margin: 0 auto;
  aspect-ratio: 9/16;
  object-fit: cover;
  min-height: 150vh;
}

/* تحسين العرض على الموبايل */
@media (max-width: 768px) {
  .projects-scroll-block .video-container {
    width: 100%;
    height: 100%;
  }
  
  .projects-scroll-block .video-badge {
    font-size: 10px;
    padding: 3px 8px;
  }
}

/* تحسين العرض على الشاشات الكبيرة */
@media (min-width: 1200px) {
  .projects-scroll-block .video-container {
    width: 100%;
    height: 100%;
  }
}

/* ضمان أن جميع الفيديوهات تحافظ على حجم ريلز */
.projects-scroll-block .item.has-video .img {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  height: 150vh !important;
  margin: 0 auto;
}

.projects-scroll-block .item.has-video .img .video-container {
  flex-shrink: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: 9/16;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150vh;
}

/* تحسين عرض الفيديو عند التكبير */
.projects-scroll-block .item.has-video:hover .video-container {
  transform: scale(1.05);
  transition: transform 0.3s ease;
}

/* تحسين تجربة الفيديو */
.projects-scroll-block .video-container video {
  transition: all 0.3s ease;
  aspect-ratio: 9/16;
  object-fit: cover;
}

.projects-scroll-block .video-container video:hover {
  transform: scale(1.02);
}

/* ضمان أن جميع الفيديوهات تحافظ على نسبة ريلز */
.projects-scroll-block .video-container video,
.projects-scroll-block .video-container iframe {
  aspect-ratio: 9/16 !important;
  object-fit: cover !important;
  min-height: 150vh;
}

/* مؤشر تشغيل الفيديو */
.projects-scroll-block .video-container.playing::after {
  content: '▶';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ff6b6b;
  font-size: 24px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.projects-scroll-block .video-container.playing:hover::after {
  opacity: 1;
}

/* ضمان أن الفيديو يحافظ على النسبة عند التكبير */
.projects-scroll-block .item.has-video .video-container video,
.projects-scroll-block .item.has-video .video-container iframe {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  aspect-ratio: 9/16;
}
