/* ═══════════════════════════════════════
   REELS — 2Loove
═══════════════════════════════════════ */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: #000;
  color: #fff;
  font-family: "Poppins", sans-serif;
  overflow: hidden;
  overflow-x: hidden;
  height: 100dvh;
  width: 100%;
  max-width: 100vw;
}

/* ── Navbar ── */
.reels-navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 52px;
  background: linear-gradient(to bottom, rgba(0,0,0,.7) 0%, transparent 100%);
  pointer-events: none;
}
.reels-navbar > * { pointer-events: all; }

.reels-logo img { height: 32px; }

.reels-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .5px;
  color: #fff;
}

.reels-nav-icons {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Scroll container ── */
#reelsContainer {
  height: 100dvh;
  width: 100%;
  max-width: 100vw;
  overflow-y: scroll;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#reelsContainer::-webkit-scrollbar { display: none; }

/* ── Single reel ── */
.reel-item {
  position: relative;
  width: 100%;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Media */
.reel-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.reel-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Text-only reel */
.reel-text-bg {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  text-align: center;
}
.reel-text-only {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.5;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
}

/* Gradient overlay */
.reel-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0,0,0,.75) 0%,
    rgba(0,0,0,.1) 40%,
    transparent 65%
  );
  pointer-events: none;
}

/* ── Bottom info ── */
.reel-bottom {
  position: absolute;
  bottom: 80px;
  left: 16px;
  right: 80px;
  z-index: 10;
}

.reel-author {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  cursor: pointer;
}

.reel-author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #fff;
  object-fit: cover;
  background: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.reel-author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reel-author-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.6);
}

.reel-caption {
  font-size: 14px;
  color: rgba(255,255,255,.92);
  line-height: 1.5;
  text-shadow: 0 1px 4px rgba(0,0,0,.6);
  max-height: 72px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.reel-music {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: rgba(255,255,255,.8);
}
.reel-music i { font-size: 12px; }

/* ── Right action bar ── */
.reel-actions {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.reel-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.reel-action-btn i {
  font-size: 22px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.75);
  box-shadow: 0 2px 10px rgba(0,0,0,.4);
  transition: transform .15s;
}
.reel-action-btn:active i { transform: scale(1.15); }

.reel-action-btn span {
  font-size: 12px;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
}

/* Jednotné černé pozadí, jen liked srdíčko dostane barvu */
.js-like.liked i    { background: rgba(0,0,0,.55); color: #ff2d55; }

/* Avatar akce */
.reel-avatar-action {
  position: relative;
  margin-bottom: 4px;
}
.reel-avatar-action .reel-author-avatar {
  width: 46px;
  height: 46px;
  border: 2px solid #fff;
}
.reel-follow-dot {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ff2d55;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  border: 2px solid #000;
  cursor: pointer;
}

/* ── Bottom mobile nav ── */
.reels-bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 64px;
  background: rgba(0,0,0,.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 200;
  border-top: 1px solid rgba(255,255,255,.08);
}

.reels-bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: rgba(255,255,255,.6);
  text-decoration: none;
  font-size: 10px;
  font-weight: 600;
  transition: color .2s;
}
.reels-bottom-nav a.active,
.reels-bottom-nav a:hover { color: #fff; }
.reels-bottom-nav a i { font-size: 22px; }

/* ── Loading / empty ── */
.reels-loading {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: rgba(255,255,255,.6);
  font-size: 15px;
}
.reels-loading i { font-size: 32px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Comment panel ── */
.reel-comments-panel {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-height: 70vh;
  background: #1a1a1a;
  border-radius: 20px 20px 0 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .3s ease;
}
.reel-comments-panel.open { transform: translateY(0); }

.comments-panel-handle {
  width: 40px;
  height: 4px;
  background: rgba(255,255,255,.3);
  border-radius: 2px;
  margin: 12px auto 8px;
}

.comments-panel-title {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.comments-panel-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comment-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.comment-avatar img { width: 100%; height: 100%; object-fit: cover; }
.comment-body { flex: 1; }
.comment-author-name { font-size: 13px; font-weight: 700; color: #fff; }
.comment-text { font-size: 13px; color: rgba(255,255,255,.85); line-height: 1.4; }
.comment-time { font-size: 11px; color: rgba(255,255,255,.4); margin-top: 2px; }

.comment-delete-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,.3);
  cursor: pointer;
  padding: 4px 5px;
  font-size: 14px;
  line-height: 1;
  transition: color .2s;
  -webkit-tap-highlight-color: transparent;
}
.comment-delete-btn:hover,
.comment-delete-btn:active { color: #ff2d55; }

.comments-panel-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 20px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.comments-panel-input input {
  flex: 1;
  background: rgba(255,255,255,.1);
  border: none;
  border-radius: 20px;
  padding: 10px 16px;
  color: #fff;
  font-size: 14px;
  outline: none;
}
.comments-panel-input input::placeholder { color: rgba(255,255,255,.4); }
.comment-send-btn {
  background: #ff2d55;
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Emoji picker ── */
.emoji-toggle-btn {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.emoji-picker {
  display: none;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  max-height: 140px;
  overflow-y: auto;
}

.emoji-picker.open { display: flex; }

/* ── Panel backdrop ── */
.panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 499;
  display: none;
}
.panel-backdrop.open { display: block; }


/* ── Desktop max-width ── */
@media (min-width: 600px) {
  #reelsContainer { max-width: 420px; margin: 0 auto; }
  .reel-comments-panel { max-width: 420px; left: 50%; transform: translateX(-50%) translateY(100%); }
  .reel-comments-panel.open { transform: translateX(-50%) translateY(0); }
}

/* ── Tablet (dotykový režim, pod desktop breakpointem 981px) ──
   Video je širší, ať se nevyplňuje černými pruhy, ale ovládání
   zůstává mobilní (swipe, spodní navigace, overlay lišta). */
@media (min-width: 600px) and (max-width: 1024px) {
  #reelsContainer { max-width: min(620px, 86vw); }
  .reel-comments-panel { max-width: min(620px, 86vw); }
}

/* ── Studio slideshow in Reels ── */
.reel-studio-wrap {
  position: absolute;
  inset: 0;
}
.reel-studio-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .6s ease;
}
.reel-studio-img.reel-studio-active {
  opacity: 1;
}

/* ═══════════════════════════════════════
   DESKTOP LAYOUT — horní lišta + boční panely
   (od 981px — pod touto hranicí zůstává dotykový
   mobilní/tablet zážitek se swipe a spodní navigací)
═══════════════════════════════════════ */

/* Mobilní overlay lišta nahoře — jen na malých obrazovkách */
nav.reels-desktop-navbar { display: none !important; }

/* Spodní mobilní navigace — jen na malých obrazovkách */
@media (min-width: 1025px) {
  .reels-bottom-nav { display: none !important; }
  .reels-navbar { display: none !important; }

  nav.reels-desktop-navbar { display: flex !important; }

  body {
    overflow: auto;
    height: auto;
    min-height: 100dvh;
  }

  .reels-page-layout {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 24px 40px;
    height: calc(100dvh - 80px);
  }

  #reelsContainer {
    position: relative;
    height: 100%;
    max-width: 420px;
    margin: 0;
    border-radius: 24px;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
  }

  .reel-item { height: 100%; border-radius: 24px; overflow: hidden; }

  .reel-comments-panel {
    max-width: 420px;
  }
}

/* ── Boční panely (Noví uživatelé / Reklama) — jen na desktopu ── */
.reels-side-panel {
  display: none;
}

@media (min-width: 1025px) {
  .reels-side-panel {
    display: block;
    width: 280px;
    flex-shrink: 0;
    background: #1a1a1e;
    border-radius: 20px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.55);
    padding: 22px;
    height: fit-content;
    position: sticky;
    top: 24px;
  }
}

.reels-panel-title {
  margin: 0 0 14px;
  font-size: 20px;
  color: #f0f0f2;
}

.reels-user-card {
  display: block;
  text-decoration: none;
  color: inherit;
}

.reels-user-card-photo {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
}

.reels-user-card-photo img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
}

.reels-user-online-dot {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #00d659;
  border: 2px solid #1a1a1e;
  box-shadow: 0 0 0 5px rgba(0, 214, 89, 0.18);
}

.reels-user-card-meta {
  padding: 12px 2px 4px;
}

.reels-user-card-name {
  font-size: 18px;
  font-weight: 800;
  color: #f0f0f2;
}

.reels-user-card-country {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  margin-top: 2px;
}

.reels-user-card-btn {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ff3b7a, #c026d3);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

.reels-ad-labels { margin-bottom: 14px; }

.reels-ad-badge {
  display: inline-flex;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.3px;
  background: rgba(255, 59, 122, 0.12);
  color: #ff3b7a;
}

.reels-ad-box {
  width: 100%;
  min-height: 260px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, rgba(255,59,122,0.9), rgba(192,38,211,0.9));
  margin-bottom: 14px;
}

.reels-ad-text {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255,255,255,0.65);
  margin-bottom: 14px;
}

.reels-ad-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ff3b7a, #c026d3);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

/* ── Šipky pro posun videa — overlay přímo na reelu, jen desktop ── */
.reels-center-col {
  position: relative;
}

.reels-scroll-arrows {
  display: none;
}

@media (min-width: 1025px) {
  .reels-scroll-arrows {
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
  }
}

.reels-scroll-arrow-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #ff2b86, #c9005e);
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 0 2px rgba(255, 43, 134, 0.18),
    0 0 14px rgba(255, 43, 134, 0.58),
    0 4px 16px rgba(0, 0, 0, 0.22);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.reels-scroll-arrow-btn:hover {
  transform: scale(1.13);
  box-shadow:
    0 0 0 3px rgba(255, 43, 134, 0.28),
    0 0 24px rgba(255, 43, 134, 0.75),
    0 6px 22px rgba(0, 0, 0, 0.28);
}

.reels-scroll-arrow-btn:active {
  transform: scale(0.95);
}

.reels-scroll-arrow-btn:disabled {
  opacity: 0.3;
  cursor: default;
  transform: none !important;
  box-shadow: none;
}
