/* FlowVella Modern Embed Player - Dark Theme */
/* Matches main modern player styling */

:root {
  --embed-bg: #0a0a0f;
  --embed-surface: #16161e;
  --embed-surface-hover: #1e1e2a;
  --embed-border: #2a2a3c;
  --embed-text: #f0f0f5;
  --embed-text-muted: #8b8b9e;
  --embed-accent: #0099FF;
  --embed-control-height: 44px;
  --embed-dot-size: 6px;
}

/* Base embed styling */
body.modern-player {
  background: var(--embed-bg) !important;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body.modern-player #player {
  background: var(--embed-bg) !important;
  position: relative;
  width: 100%;
  height: 100%;
}

body.modern-player #container_wrapper {
  border-radius: 0;
  overflow: hidden;
}

body.modern-player #container {
  border-radius: 0;
}

/* Hide legacy UI */
body.modern-player #share_menu,
body.modern-player #slider,
body.modern-player #preview_container,
body.modern-player .share_button,
body.modern-player #auto_advance_indicator,
body.modern-player #status_bar,
body.modern-player #control_bar,
body.modern-player #show_watermark,
body.modern-player #auto_advance_indicator_standin {
  display: none !important;
}

/* ========== MODERN EMBED CONTROLS ========== */
.modern-embed-controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--embed-control-height);
  background: rgba(22, 22, 30, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--embed-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.3s ease;
}

body.modern-player:hover .modern-embed-controls,
body.modern-player:focus-within .modern-embed-controls,
.modern-embed-controls:hover,
.modern-embed-controls.visible {
  opacity: 1;
}

/* Touch devices - always show controls */
@media (hover: none) {
  .modern-embed-controls {
    opacity: 1;
  }
}

/* Left: Navigation */
.modern-embed-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.modern-embed-nav-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--embed-text);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.modern-embed-nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.modern-embed-nav-btn.disabled {
  opacity: 0.3;
  pointer-events: none;
}

.modern-embed-nav-btn svg {
  width: 18px;
  height: 18px;
}

/* Center: Dots */
.modern-embed-dots {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 50%;
  overflow: hidden;
}

.modern-embed-dot {
  width: var(--embed-dot-size);
  height: var(--embed-dot-size);
  min-width: var(--embed-dot-size);
  border-radius: 50%;
  background: var(--embed-text-muted);
  opacity: 0.4;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: block;
}

.modern-embed-dot:hover {
  opacity: 0.7;
}

.modern-embed-dot.active {
  width: 18px;
  border-radius: 3px;
  background: var(--embed-text);
  opacity: 1;
}

.modern-embed-ellipsis {
  color: var(--embed-text-muted);
  font-size: 10px;
  opacity: 0.5;
}

/* Windowed dots for many slides */
.modern-embed-dots[data-total-slides] .modern-embed-dot {
  transition: opacity 0.2s ease, width 0.2s ease;
}

.modern-embed-dots .modern-embed-dot.hidden {
  display: none;
}

/* Right: Actions */
.modern-embed-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modern-embed-counter {
  font-size: 12px;
  color: var(--embed-text-muted);
  white-space: nowrap;
}

.modern-embed-counter-current {
  color: var(--embed-text);
}

.modern-embed-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--embed-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.modern-embed-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--embed-text);
}

.modern-embed-btn svg {
  width: 16px;
  height: 16px;
}

/* Fullscreen button */
.modern-embed-fullscreen svg {
  width: 18px;
  height: 18px;
}

/* FlowVella logo link */
.modern-embed-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--embed-text-muted);
  font-size: 11px;
  font-weight: 500;
  gap: 4px;
  transition: color 0.2s ease;
}

.modern-embed-logo:hover {
  color: var(--embed-text);
}

.modern-embed-logo img {
  height: 18px;
  width: auto;
  border-radius: 4px;
  opacity: 0.8;
}

/* ========== AUTOPLAY PROGRESS ========== */
.modern-embed-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
}

.modern-embed-progress-fill {
  height: 100%;
  width: 100%;
  background: var(--embed-accent);
  transform-origin: left;
}

.modern-embed-autoplay-btn {
  width: 28px;
  height: 28px;
}

.modern-embed-autoplay-btn.paused {
  color: var(--embed-accent);
}

/* ========== SHARE DRAWER (SIMPLIFIED FOR EMBED) ========== */
.modern-embed-share-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 200;
}

.modern-embed-share-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modern-embed-share-panel {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 320px;
  background: var(--embed-surface);
  border: 1px solid var(--embed-border);
  border-bottom: none;
  border-radius: 16px 16px 0 0;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 300;
}

.modern-embed-share-panel.open {
  transform: translateX(-50%) translateY(0);
}

.modern-embed-share-handle {
  width: 32px;
  height: 4px;
  background: var(--embed-border);
  border-radius: 2px;
  margin: 0 auto 12px;
}

.modern-embed-share-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--embed-text);
  margin: 0 0 12px;
  text-align: center;
}

.modern-embed-share-url {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.modern-embed-share-url input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  background: var(--embed-bg);
  border: 1px solid var(--embed-border);
  border-radius: 8px;
  color: var(--embed-text);
  font-size: 12px;
  outline: none;
  box-sizing: border-box;
}

.modern-embed-share-copy {
  height: 38px;
  padding: 0 16px;
  background: var(--embed-accent);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.modern-embed-share-copy:hover {
  background: #33adff;
}

.modern-embed-share-copy.copied {
  background: #22c55e;
}

.modern-embed-share-social {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.modern-embed-share-social a {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--embed-surface-hover);
  border: 1px solid var(--embed-border);
  border-radius: 50%;
  color: var(--embed-text);
  text-decoration: none;
  transition: all 0.2s ease;
}

.modern-embed-share-social a:hover {
  background: var(--embed-border);
}

.modern-embed-share-social svg {
  width: 20px;
  height: 20px;
}

/* ========== RESPONSIVE ========== */

/* Small embeds */
@media (max-width: 480px), (max-height: 320px) {
  :root {
    --embed-control-height: 40px;
    --embed-dot-size: 5px;
  }

  .modern-embed-controls {
    padding: 0 8px;
  }

  .modern-embed-nav-btn {
    width: 28px;
    height: 28px;
  }

  .modern-embed-nav-btn svg {
    width: 16px;
    height: 16px;
  }

  .modern-embed-dots {
    gap: 4px;
  }

  .modern-embed-dot.active {
    width: 14px;
  }

  .modern-embed-counter {
    font-size: 11px;
  }

  .modern-embed-btn {
    width: 28px;
    height: 28px;
  }

  .modern-embed-btn svg {
    width: 14px;
    height: 14px;
  }

  .modern-embed-logo {
    font-size: 10px;
  }

  .modern-embed-logo img {
    height: 16px;
  }
}

/* Very small embeds - hide some elements */
@media (max-width: 320px) {
  .modern-embed-counter {
    display: none;
  }

  .modern-embed-logo span {
    display: none;
  }
}

/* Landscape small height */
@media (max-height: 280px) {
  :root {
    --embed-control-height: 36px;
  }

  .modern-embed-logo {
    display: none;
  }
}
