/**
 * REMOJAV Network - Custom Multi-Site Web Player (RemoPlayer)
 * Stylesheet for HLS .jpeg Video Streaming & Advanced Subtitle Engine
 * Compatible with REMOJAV, DESIJAV, BANGLAJAV, TURKCEJAV & BOKUNO
 */

:root {
  --remo-primary: #e50914; /* Crimson Red */
  --remo-primary-hover: #ff2a36;
  --remo-bg: #0b0e14;
  --remo-surface: #151a23;
  --remo-surface-hover: #202735;
  --remo-text: #ffffff;
  --remo-text-muted: #9ca3af;
  --remo-border: rgba(255, 255, 255, 0.12);
  --remo-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.8);
  
  /* Subtitle Styling Variables (dynamically controlled via JS) */
  --sub-font-size: 22px;
  --sub-color: #ffd700; /* Gold default for adult contrast */
  --sub-bg-color: rgba(0, 0, 0, 0.65);
  --sub-shadow: 2px 2px 4px #000000, -2px -2px 4px #000000, 2px -2px 4px #000000, -2px 2px 4px #000000, 0 3px 6px rgba(0,0,0,0.9);
  --sub-bottom: 70px;

  /* Picture Enhancement Variables (MISSAV Studio Vivid Mode) */
  --video-brightness: 1.04; /* +4% Brightness for punchy studio lighting */
  --video-contrast: 1.05;   /* +5% Contrast for deep rich blacks */
  --video-saturate: 1.08;   /* +8% Saturation for healthy rosy skin tones */
}

/* ==================== PLAYER CONTAINER ==================== */
.remo-player-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #000000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--remo-shadow);
  user-select: none;
  -webkit-user-select: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--remo-text);
  outline: none;
}

.remo-player-container:fullscreen,
.remo-player-container:-webkit-full-screen {
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  aspect-ratio: auto !important;
}

/* Pseudo Fullscreen for iOS/Mobile fallback */
.remo-player-container.is-pseudo-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 999999 !important;
  border-radius: 0 !important;
}

.remo-video-element {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background-color: #000000;
  cursor: pointer;
  filter: brightness(var(--video-brightness, 1.04)) contrast(var(--video-contrast, 1.05)) saturate(var(--video-saturate, 1.08));
  transition: filter 0.25s ease;
}

/* Hide native video captions as we render custom high-contrast overlay */
.remo-video-element::cue {
  display: none !important;
  opacity: 0 !important;
}

/* ==================== SUBTITLE OVERLAY ==================== */
.remo-subtitle-overlay {
  position: absolute;
  left: 5%;
  right: 5%;
  bottom: var(--sub-bottom);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
  z-index: 25;
  transition: bottom 0.25s ease;
  text-align: center;
}

.remo-subtitle-text {
  display: inline-block;
  font-size: var(--sub-font-size);
  font-weight: 700;
  color: var(--sub-color);
  background-color: var(--sub-bg-color);
  text-shadow: var(--sub-shadow);
  line-height: 1.35;
  padding: 4px 12px;
  border-radius: 6px;
  max-width: 90%;
  word-break: break-word;
  white-space: pre-wrap;
  transition: all 0.15s ease-out;
}

/* If controls are hidden, lower subtitles slightly */
.remo-player-container.controls-hidden .remo-subtitle-overlay {
  --sub-bottom: 24px;
}

/* ==================== LOADING & BUFFERING SPINNER ==================== */
.remo-spinner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s;
}

.remo-player-container.is-buffering .remo-spinner-overlay {
  opacity: 1;
  visibility: visible;
}

.remo-spinner {
  width: 56px;
  height: 56px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--remo-primary);
  border-radius: 50%;
  animation: remo-spin 0.8s linear infinite;
}

@keyframes remo-spin {
  to { transform: rotate(360deg); }
}

/* ==================== BIG CENTER PLAY BUTTON ==================== */
.remo-big-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  width: 72px;
  height: 72px;
  background: rgba(229, 9, 20, 0.9);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 45;
  pointer-events: auto;
  box-shadow: 0 0 30px rgba(229, 9, 20, 0.6);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.2s ease;
}

.remo-big-play-btn:hover {
  transform: translate(-50%, -50%) scale(1.1);
  background: var(--remo-primary-hover);
}

.remo-big-play-btn svg {
  width: 32px;
  height: 32px;
  fill: #ffffff;
  margin-left: 4px;
}

.remo-player-container.is-playing .remo-big-play-btn {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.7);
}

/* ==================== MOBILE DOUBLE-TAP RIPPLE ==================== */
.remo-touch-ripple {
  position: absolute;
  top: 0;
  bottom: 60px;
  width: 40%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 35;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.remo-touch-ripple.ripple-left {
  left: 0;
  background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.2) 0%, transparent 60%);
}

.remo-touch-ripple.ripple-right {
  right: 0;
  background: radial-gradient(circle at 70% 50%, rgba(255,255,255,0.2) 0%, transparent 60%);
}

.remo-touch-ripple.active {
  opacity: 1;
  animation: remo-ripple-pulse 0.6s ease-out;
}

.remo-ripple-badge {
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

@keyframes remo-ripple-pulse {
  0% { transform: scale(0.85); opacity: 0.2; }
  50% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}

/* ==================== CONTROLS OVERLAY ==================== */
.remo-controls-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.4) 30%, transparent 70%);
  z-index: 40;
  padding: 0 16px 12px 16px;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0.3s;
  pointer-events: none;
}

.remo-controls-overlay .remo-progress-wrapper,
.remo-controls-overlay .remo-controls-row {
  pointer-events: auto;
}

.remo-player-container.controls-hidden .remo-controls-overlay {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ==================== PROGRESS / SEEK BAR ==================== */
.remo-progress-wrapper {
  position: relative;
  width: 100%;
  height: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  touch-action: none;
}

.remo-progress-track {
  position: relative;
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  overflow: visible;
  transition: height 0.15s ease;
}

.remo-progress-wrapper:hover .remo-progress-track {
  height: 8px;
}

.remo-progress-buffer {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: rgba(255, 255, 255, 0.45);
  border-radius: 4px;
  pointer-events: none;
  transition: width 0.15s linear;
}

.remo-progress-played {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: var(--remo-primary);
  border-radius: 4px;
  pointer-events: none;
}

.remo-progress-thumb {
  position: absolute;
  top: 50%;
  right: -7px;
  transform: translateY(-50%) scale(0);
  width: 14px;
  height: 14px;
  background: #ffffff;
  border: 2px solid var(--remo-primary);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
  transition: transform 0.15s ease;
}

.remo-progress-wrapper:hover .remo-progress-thumb,
.remo-progress-wrapper.is-scrubbing .remo-progress-thumb {
  transform: translateY(-50%) scale(1);
}

.remo-seek-tooltip {
  position: absolute;
  bottom: 24px;
  left: 0;
  transform: translateX(-50%);
  background: rgba(15, 20, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  transition: opacity 0.15s ease;
}

.remo-progress-wrapper:hover .remo-seek-tooltip {
  opacity: 1;
}

/* ==================== CONTROL BUTTONS BAR ==================== */
.remo-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 6px;
  gap: 8px;
}

.remo-controls-left,
.remo-controls-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.remo-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.remo-btn:hover {
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.remo-btn:active {
  transform: scale(0.92);
}

.remo-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* Skip 10s button badges */
.remo-btn-skip {
  position: relative;
}

.remo-btn-skip .skip-label {
  position: absolute;
  font-size: 8px;
  font-weight: 800;
  bottom: 6px;
}

/* Time display */
.remo-time-display {
  font-size: 13px;
  font-weight: 500;
  color: #e5e7eb;
  margin-left: 6px;
  white-space: nowrap;
  letter-spacing: 0.3px;
}

.remo-time-current {
  color: #ffffff;
  font-weight: 600;
}

.remo-time-separator {
  margin: 0 4px;
  color: #6b7280;
}

.remo-time-total {
  color: #9ca3af;
}

/* Volume Slider */
.remo-volume-group {
  display: flex;
  align-items: center;
}

.remo-volume-slider-wrap {
  width: 0;
  overflow: hidden;
  transition: width 0.2s ease, margin 0.2s ease;
  display: flex;
  align-items: center;
}

.remo-volume-group:hover .remo-volume-slider-wrap,
.remo-volume-group:focus-within .remo-volume-slider-wrap {
  width: 65px;
  margin-left: 4px;
}

.remo-volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 65px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.remo-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
}

/* Active indicator badges */
.remo-btn.is-active {
  color: var(--remo-primary);
}

.remo-btn.has-subtitle::after {
  content: '';
  position: absolute;
  bottom: 6px;
  width: 4px;
  height: 4px;
  background: var(--remo-primary);
  border-radius: 50%;
}

/* ==================== MENUS & POPOVERS ==================== */
.remo-popover-menu {
  position: absolute;
  bottom: 56px;
  right: 16px;
  background: rgba(18, 22, 32, 0.96);
  backdrop-filter: blur(12px);
  border: 1px solid var(--remo-border);
  border-radius: 10px;
  padding: 8px 0;
  min-width: 210px;
  max-width: 320px;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.7);
  z-index: 50;
  display: none;
  animation: remo-menu-in 0.18s ease-out;
}

.remo-popover-menu.is-open {
  display: block;
}

@keyframes remo-menu-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.remo-menu-title {
  padding: 6px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #9ca3af;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.remo-menu-item {
  width: 100%;
  padding: 8px 16px;
  background: transparent;
  border: none;
  color: #e5e7eb;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.remo-menu-item:hover {
  background-color: var(--remo-surface-hover);
  color: #ffffff;
}

.remo-menu-item.is-selected {
  color: var(--remo-primary);
  font-weight: 700;
  background-color: rgba(229, 9, 20, 0.12);
}

.remo-menu-item .item-code {
  font-size: 11px;
  color: #6b7280;
  text-transform: uppercase;
}

.remo-menu-item.is-selected .item-code {
  color: var(--remo-primary);
}

.remo-menu-footer-btn {
  width: calc(100% - 16px);
  margin: 6px 8px 2px 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.remo-menu-footer-btn:hover {
  background: rgba(229, 9, 20, 0.85);
  border-color: var(--remo-primary);
}

/* ==================== SUBTITLE CUSTOMIZATION MODAL ==================== */
.remo-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s;
  padding: 16px;
}

.remo-modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.remo-modal-dialog {
  background: #151a23;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  width: 100%;
  max-width: 440px;
  padding: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.remo-modal-overlay.is-open .remo-modal-dialog {
  transform: scale(1);
}

.remo-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--remo-border);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.remo-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.remo-modal-close {
  background: transparent;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}

.remo-modal-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.remo-modal-group {
  margin-bottom: 16px;
}

.remo-modal-label {
  font-size: 12px;
  font-weight: 600;
  color: #9ca3af;
  margin-bottom: 8px;
  display: block;
}

.remo-size-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.remo-size-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e5e7eb;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.remo-size-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.remo-size-btn.active {
  background: var(--remo-primary);
  border-color: var(--remo-primary);
  color: #fff;
}

.remo-color-selector {
  display: flex;
  gap: 10px;
}

.remo-color-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.remo-color-dot:hover {
  transform: scale(1.15);
}

.remo-color-dot.active {
  border-color: #ffffff;
  transform: scale(1.15);
  box-shadow: 0 0 10px rgba(255,255,255,0.5);
}

.remo-bg-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.remo-bg-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e5e7eb;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.remo-bg-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.remo-bg-btn.active {
  background: var(--remo-primary);
  border-color: var(--remo-primary);
  color: #fff;
}

.remo-subtitle-preview-box {
  background: #000;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  margin-top: 14px;
}

/* ==================== MOBILE RESPONSIVE TWEAKS ==================== */
@media (max-width: 640px) {
  .remo-controls-overlay {
    padding: 0 10px 8px 10px;
  }
  .remo-btn {
    width: 34px;
    height: 34px;
  }
  .remo-btn svg {
    width: 19px;
    height: 19px;
  }
  .remo-time-display {
    font-size: 11px;
    margin-left: 2px;
  }
  .remo-volume-group {
    display: none; /* Hide volume slider on mobile; users use hardware volume keys */
  }
  .remo-popover-menu {
    right: 8px;
    bottom: 48px;
    max-width: 240px;
  }
  .remo-big-play-btn {
    width: 56px;
    height: 56px;
  }
  .remo-big-play-btn svg {
    width: 24px;
    height: 24px;
  }
}

/* ==================== TOAST NOTIFICATION ==================== */
.remo-player-toast {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 20px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  pointer-events: none;
  z-index: 60;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7);
  animation: remoToastAnim 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

@keyframes remoToastAnim {
  from { opacity: 0; transform: translate(-50%, -12px) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
