/**
 * Swiper Video Reels CSS - COMPLETE VERSION
 * FIXED: Mobile video controls issue - removes play button overlay and black backgrounds
 * Modified with split layout for desktop: video on left, product details on right
 * Updated to improve desktop navigation arrows and media controls positioning
 * Added styles for outside navigation arrows
 * UPDATED: Enhanced mobile product card with glassmorphism effect
 */

/* Base modal styles */
#playlist-video-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 9999;
  display: none;
  overflow: hidden;
}

/* MOBILE VIDEO CONTROLS FIX - CRITICAL SECTION */
@media (max-width: 991px) {
  /* Hide ALL video controls on mobile */
  .reel-video {
    /* Remove controls completely */
    controls: none !important;

    /* Remove background colors */
    background: transparent !important;
    background-color: transparent !important;

    /* Remove outline/focus styles */
    outline: none !important;
    border: none !important;

    /* Ensure proper object fit */
    object-fit: cover !important;
    width: 100% !important;
    height: 100% !important;
  }

  /* Hide webkit video controls */
  .reel-video::-webkit-media-controls {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
  }

  .reel-video::-webkit-media-controls-panel {
    display: none !important;
  }

  .reel-video::-webkit-media-controls-play-button {
    display: none !important;
  }

  .reel-video::-webkit-media-controls-timeline {
    display: none !important;
  }

  .reel-video::-webkit-media-controls-current-time-display {
    display: none !important;
  }

  .reel-video::-webkit-media-controls-time-remaining-display {
    display: none !important;
  }

  .reel-video::-webkit-media-controls-mute-button {
    display: none !important;
  }

  .reel-video::-webkit-media-controls-volume-slider {
    display: none !important;
  }

  .reel-video::-webkit-media-controls-fullscreen-button {
    display: none !important;
  }

  /* Most important - hide the big play button overlay */
  .reel-video::-webkit-media-controls-overlay-play-button {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .reel-video::-webkit-media-controls-start-playback-button {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
  }

  /* Hide loading spinner and buffering indicators */
  .reel-video::-webkit-media-controls-loading-panel {
    display: none !important;
  }

  /* Remove any webkit appearance */
  .reel-video {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    -webkit-playsinline: true !important;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  /* Ensure Swiper slides have transparent backgrounds */
  .swiper-slide {
    background: transparent !important;
    background-color: transparent !important;
  }

  .swiper-slide video {
    background: transparent !important;
    background-color: transparent !important;
  }

  /* Remove any poster/loading state backgrounds */
  .reel-video[poster] {
    background: transparent !important;
    background-color: transparent !important;
  }

  .reel-video:not([src]) {
    background: transparent !important;
    background-color: transparent !important;
  }

  /* Ensure modal containers have transparent backgrounds too */
  #playlist-video-modal .swiper-container {
    background: transparent !important;
  }

  #playlist-video-modal .swiper-wrapper {
    background: transparent !important;
  }

  /* Additional fixes for different video states */
  .reel-video:paused {
    background: transparent !important;
  }

  .reel-video:playing {
    background: transparent !important;
  }

  .reel-video:waiting {
    background: transparent !important;
  }

  .reel-video:seeking {
    background: transparent !important;
  }

  /* Hide any custom video overlays that might appear */
  .video-overlay,
  .video-controls-overlay,
  .video-loading-overlay,
  .video-play-overlay {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
  }

  /* iOS specific control hiding */
  .reel-video::-webkit-media-controls-wireless-playback-picker-button {
    display: none !important;
  }

  .reel-video::-webkit-media-controls-picture-in-picture-button {
    display: none !important;
  }
}

/* Force remove controls attribute via CSS (backup) */
@media (max-width: 991px) {
  .reel-video[controls] {
    controls: none !important;
  }
}

/* Desktop modal sizing - split into two halves */
@media (min-width: 992px) {
  #playlist-video-modal .modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    max-height: 80vh;
    max-width: 1200px;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: row;
    background-color: #fff;
    z-index: 10003;
  }

  /* Video container on the left */
  #playlist-video-modal .video-container {
    width: 50%;
    height: 100%;
    position: relative;
    background: #000;
    z-index: 10001;
  }

  /* Product details container on the right */
  #playlist-video-modal .product-details-container {
    width: 50%;
    height: 100%;
    padding: 30px;
    overflow-y: auto;
    background: #fff;
    color: #333;
    position: relative;
    z-index: 10005; /* Higher z-index to stay above video */
  }

  #playlist-video-modal .swiper-container {
    width: 100%;
    height: 100%;
    z-index: 1;
  }

  /* Enhanced Navigation buttons for desktop - these will be hidden in favor of outside arrows */
  #playlist-video-modal .swiper-button-next,
  #playlist-video-modal .swiper-button-prev {
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10002;
    opacity: 0.7;
    transition: opacity 0.3s ease, transform 0.3s ease;
  }

  #playlist-video-modal .swiper-button-next {
    right: 10px;
  }

  #playlist-video-modal .swiper-button-prev {
    left: 10px;
  }

  #playlist-video-modal .swiper-button-next:hover,
  #playlist-video-modal .swiper-button-prev:hover {
    opacity: 1;
    transform: scale(1.1);
  }

  #playlist-video-modal .swiper-button-next:after,
  #playlist-video-modal .swiper-button-prev:after {
    font-size: 20px;
  }

  /* Make sure the grab cursor is disabled on desktop */
  #playlist-video-modal .swiper-container {
    cursor: default !important;
  }

  #playlist-video-modal .swiper-slide {
    cursor: default !important;
  }

  /* NEW: Outside navigation arrows for desktop */
  .modal-navigation-prev,
  .modal-navigation-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10010;
    cursor: pointer;
    transition: all 0.3s ease;
  }

  .modal-navigation-prev {
    left: 5%;
  }

  .modal-navigation-next {
    right: 5%;
  }

  /* Style the arrow icons */
  .modal-navigation-prev .swiper-button-prev-icon:after,
  .modal-navigation-next .swiper-button-next-icon:after {
    font-family: "swiper-icons";
    font-size: 24px;
    text-transform: none !important;
    letter-spacing: 0;
    font-variant: initial;
    line-height: 1;
    color: white;
  }

  .modal-navigation-prev .swiper-button-prev-icon:after {
    content: "prev";
  }

  .modal-navigation-next .swiper-button-next-icon:after {
    content: "next";
  }

  /* Hover effects for the outside arrows */
  .modal-navigation-prev:hover,
  .modal-navigation-next:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
  }

  /* Hide the inner navigation arrows on desktop */
  #playlist-video-modal .video-container .swiper-button-next,
  #playlist-video-modal .video-container .swiper-button-prev {
    display: none !important;
  }
}

/* Close button */
#playlist-video-modal .close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  z-index: 10010; /* Highest z-index to stay on top */
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
}

/* Swiper container */
.swiper-container {
  width: 100%;
  height: 100%;
  color: white;
  position: relative;
  z-index: 1;
}

/* Swiper slides */
.swiper-slide {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #000;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* Video element - UPDATED with mobile fixes */
.swiper-slide video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* Additional global video fixes */
.reel-video {
  /* Ensure no default browser styling */
  border: none !important;
  margin: 0 !important;
  padding: 0 !important;

  /* Remove any default backgrounds */
  background: transparent !important;

  /* Ensure proper display */
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

/* Media controls - updated positioning */
.media-controls {
  position: fixed;
  top: 80px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10004;
}

/* Media controls - updated with larger icon sizes */
.media-control-btn {
  width: 50px; /* Increased from 40px */
  height: 50px; /* Increased from 40px */
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  margin-bottom: 10px;
  cursor: pointer;
}

/* Add this new style for the icons inside the buttons */
.media-control-btn i {
  font-size: 24px; /* Larger icon size */
}

/* Ensure the sound toggle and other media control icons are larger */
.sound-toggle i,
.share-btn i,
.cart-btn i {
  font-size: 24px; /* Increased from default size */
}

.media-control-btn:hover {
  background-color: rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
}

/* Desktop Product Details Styling */
@media (min-width: 992px) {
  .desktop-product-details {
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10005;
  }

  .desktop-product-image {
    width: 100%;
    height: 40%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f8f8;
    border-radius: 8px;
    margin-bottom: 20px;
  }

  .desktop-product-image img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
  }

  .desktop-product-info {
    flex-grow: 1;
  }

  .desktop-product-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 15px;
    color: #333;
  }

  .desktop-product-price {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #033465;
  }

  .desktop-product-description {
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.5;
    color: #555;
  }

  .desktop-shop-now-btn {
    background-color: #033465;
    color: white;
    font-weight: bold;
    text-align: center;
    padding: 15px 20px;
    font-size: 18px;
    border: none;
    border-radius: 4px;
    width: 100%;
    margin-top: 20px;
    display: block;
    text-decoration: none;
    transition: background-color 0.3s;
  }

  .desktop-shop-now-btn:hover {
    background-color: #022345;
  }

  /* Updated positioning for media controls on desktop */
  #playlist-video-modal .media-controls {
    right: auto;
    left: 20px;
    top: 20px;
  }

  #playlist-video-modal .swiper-button-next,
  #playlist-video-modal .swiper-button-prev {
    display: flex !important;
    color: #fff !important;
    background: rgba(0, 0, 0, 0.5) !important;
    width: 50px !important;
    height: 50px !important;
    border-radius: 50% !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 10005 !important;
    opacity: 0.8 !important;
    transition: opacity 0.3s ease, transform 0.3s ease !important;
    position: absolute !important;
  }

  /* Position the buttons properly within the video container */
  #playlist-video-modal .video-container .swiper-button-next {
    right: 20px !important;
  }

  #playlist-video-modal .video-container .swiper-button-prev {
    left: 20px !important;
  }

  /* Make buttons more visible with hover effects */
  #playlist-video-modal .swiper-button-next:hover,
  #playlist-video-modal .swiper-button-prev:hover {
    opacity: 1 !important;
    transform: scale(1.1) !important;
  }

  /* Ensure the arrow icons are visible */
  #playlist-video-modal .swiper-button-next:after,
  #playlist-video-modal .swiper-button-prev:after {
    font-size: 24px !important;
    color: white !important;
  }
}

/* UPDATED: New Modern Mobile Product Card Styling */
@media (max-width: 991px) {
  /* Modal takes full screen on mobile */
  #playlist-video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }

  #playlist-video-modal .modal-content {
    width: 100%;
    height: 100%;
  }

  /* Swiper full-screen vertical direction */
  .swiper-container {
    width: 100%;
    height: 100vh;
  }

  .swiper-slide {
    height: 100vh;
  }

  /* Hide regular arrows on mobile */
  .swiper-button-next,
  .swiper-button-prev {
    display: none;
  }

  /* Hide outside navigation arrows on mobile */
  .modal-navigation-prev,
  .modal-navigation-next {
    display: none !important;
  }

  /* NEW: Modern glassmorphism card design */
  .product-overlay.product-card-modern {
    position: absolute;
    bottom: 20px;
    left: 10%;
    right: 10%;
    width: 80%;
    height: 15vh;
    min-height: 120px;
    max-height: 150px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    z-index: 1001;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
  }

  /* Enhanced hover effect for modern card */
  .product-overlay.product-card-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  }

  /* Modern product info styling */
  .product-card-modern .product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    min-width: 0;
  }

  /* Modern product title styling */
  .product-card-modern .product-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Modern product price styling */
  .product-card-modern .product-price {
    font-size: 18px;
    font-weight: 700;
    color: #4ade80;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    margin: 0;
  }

  /* Modern shop button styling */
  .product-card-modern .shop-now-btn {
    background: rgba(59, 130, 246, 0.9);
    color: white;
    font-weight: 600;
    text-align: center;
    padding: 8px 16px;
    font-size: 14px;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    margin-top: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: block;
    max-width: 120px;
  }

  /* Shop button hover effects */
  .product-card-modern .shop-now-btn:hover {
    background: rgba(37, 99, 235, 1);
    transform: translateY(-1px);
  }

  /* Modern product thumbnail styling */
  .product-card-modern .product-thumbnail {
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
  }

  .product-card-modern .product-thumbnail img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
  }

  /* Responsive adjustments for very small screens */
  @media (max-width: 480px) {
    .product-card-modern {
      left: 5% !important;
      right: 5% !important;
      width: 90% !important;
      padding: 12px;
      gap: 12px;
    }

    .product-card-modern .product-title {
      font-size: 15px;
    }

    .product-card-modern .product-price {
      font-size: 16px;
    }

    .product-card-modern .shop-now-btn {
      padding: 6px 12px;
      font-size: 13px;
      max-width: 100px;
    }

    .product-card-modern .product-thumbnail {
      width: 60px;
      height: 60px;
      padding: 6px;
    }
  }

  /* Legacy product overlay styling - keep for backward compatibility */
  .product-overlay:not(.product-card-modern) {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(73, 73, 72, 0.7);
    padding: 15px;
    color: white;
    z-index: 1001;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
  }

  .product-overlay:not(.product-card-modern) .product-info {
    flex-grow: 1;
    padding-right: 15px;
  }

  .product-overlay:not(.product-card-modern) .product-title {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 10px;
    color: white;
  }

  .product-overlay:not(.product-card-modern) .product-price {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 15px;
    color: white;
  }

  .product-overlay:not(.product-card-modern) .shop-now-btn {
    background-color: #033465;
    color: white;
    font-weight: bold;
    text-align: center;
    padding: 12px 15px;
    font-size: 16px;
    border: none;
    border-radius: 4px;
    width: 100%;
    max-width: 230px;
    display: block;
    text-decoration: none;
  }

  .product-overlay:not(.product-card-modern) .product-thumbnail {
    width: 80px;
    height: 80px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 6px;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .product-overlay:not(.product-card-modern) .product-thumbnail img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }
}

/* Ensure our product overlay shows above everything */
.product-overlay,
.product-card-modern {
  z-index: 1001 !important;
  position: relative !important;
}

/* Make sure video doesn't interfere with product overlay */
.swiper-slide {
  position: relative !important;
}

.swiper-slide .reel-video {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 1 !important;
}

/* Slide up fade in animation for modern cards */
@keyframes slideUpFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Apply animation to modern cards */
.product-card-modern {
  animation: slideUpFadeIn 0.3s ease forwards;
}

/* Toast and button animations - keep from original code */
.product-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  max-width: 350px;
  background: white;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 11000; /* Above everything else */
  overflow: hidden;
}

.product-toast-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 15px;
  background-color: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
}

.product-toast-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  margin-left: 10px;
  opacity: 0.5;
}

.product-toast-close:hover {
  opacity: 0.75;
}

.product-toast-body {
  padding: 15px;
  display: flex;
  align-items: center;
}

.product-toast-image {
  width: 60px;
  height: 60px;
  margin-right: 15px;
  border: 1px solid #eee;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-toast-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.product-toast-content {
  flex-grow: 1;
}

.product-toast-title {
  margin-bottom: 10px;
  font-weight: bold;
}

.product-toast-button {
  display: inline-block;
  background: #033465;
  color: white;
  padding: 8px 15px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 14px;
}

/* Button states */
.button-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spinner-rotation 0.8s linear infinite;
  margin-right: 6px;
}

@keyframes spinner-rotation {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.button-icon {
  margin-right: 5px;
}

.button-success {
  background-color: #28a745;
  border-color: #28a745;
}

.button-error {
  background-color: #dc3545;
  border-color: #dc3545;
}

/* Loading state for desktop */
.desktop-product-details.loading-state {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  text-align: center;
}

.desktop-product-loader {
  padding: 30px;
  text-align: center;
}

.loader-spinner {
  display: inline-block;
  width: 50px;
  height: 50px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: #033465;
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.desktop-product-loader p {
  color: #555;
  font-size: 16px;
}

/* Hide the default navigation arrows on desktop */
@media (min-width: 992px) {
  #playlist-video-modal .video-container .swiper-button-next,
  #playlist-video-modal .video-container .swiper-button-prev {
    display: none !important;
  }
}

/* Hide outside arrows on mobile */
@media (max-width: 991px) {
  .modal-navigation-prev,
  .modal-navigation-next {
    display: none !important;
  }
}
@media (max-width: 991px) {
  #playlist-video-modal .cart-btn {
    display: none !important;
  }
}
