/* ═══════════════════════════════════════
   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;
  min-width: 0;
  background: rgba(255,255,255,.1);
  border: none;
  border-radius: 20px;
  padding: 10px 16px;
  color: #fff;
  font-size: 16px;
  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); }
}

/* ── 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;
}
