﻿/* Reels — parity with ReelsScreen.tsx */

body.ic-reels-page .ic-header,
body.ic-reels-page .ic-footer,
body.ic-reels-page .ic-tabbar {
  display: none !important;
}

body.ic-reels-page {
  background: #000;
  overflow: hidden;
}

.ic-reels {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  color: #fff;
  direction: rtl;
  overflow: hidden;
  font-family: "IRANYekan", Tahoma, sans-serif;
}

.ic-reels-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
  pointer-events: none;
}

.ic-reels-top > * {
  pointer-events: auto;
}

.ic-reels-back,
.ic-reels-cat-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  position: relative;
}

.ic-reels-back img,
.ic-reels-cat-btn img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

.ic-reels-cat-badge {
  position: absolute;
  top: 2px;
  left: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #4e91e6;
  color: #fff;
  font-size: 9px;
  line-height: 16px;
  text-align: center;
  font-family: "IRANYekanFa", "IRANYekan", sans-serif;
}

.ic-reels-cat-badge[hidden] {
  display: none !important;
}

.ic-reels-feed {
  height: 100%;
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  scroll-behavior: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.ic-reels-feed::-webkit-scrollbar {
  display: none;
}

.ic-reels-item {
  position: relative;
  height: 100%;
  height: 100dvh;
  width: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background: #000;
  overflow: hidden;
}

.ic-reels-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.ic-reels-buf {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ic-reels-spin 0.7s linear infinite;
  opacity: 0;
  pointer-events: none;
  z-index: 5;
}

.ic-reels-item.is-buffering .ic-reels-buf {
  opacity: 1;
}

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

.ic-reels-gradient {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72), transparent);
  pointer-events: none;
  z-index: 2;
}

.ic-reels-pp-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  z-index: 6;
  transition: opacity 0.15s ease;
}

.ic-reels-pp-icon.is-visible {
  opacity: 1;
}

.ic-reels-pp-icon img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.ic-reels-caption {
  position: absolute;
  left: 16px;
  right: 20px;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  z-index: 4;
  text-align: right;
  direction: rtl;
  pointer-events: none;
}

.ic-reels-caption-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: #fff;
  text-align: right;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  font-family: "IRANYekan", Tahoma, sans-serif;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ic-reels-controls {
  position: absolute;
  right: 17px;
  left: auto;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.ic-reels-ctrl {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  padding: 0;
  min-width: 48px;
}

.ic-reels-ctrl img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.ic-reels-ctrl.is-pop img {
  animation: ic-reels-ctrl-pop 0.22s ease;
}

@keyframes ic-reels-ctrl-pop {
  0% { transform: scale(1); opacity: 1; }
  40% { transform: scale(1.22); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

.ic-reels-ctrl-label {
  font-size: 10.5px;
  line-height: 1.2;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  font-family: "IRANYekanFa", "IRANYekan", Tahoma, sans-serif;
}

.ic-reels-ctrl.is-busy {
  opacity: 0.55;
  pointer-events: none;
}

.ic-reels-dbl-heart {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 160px;
  height: 160px;
  margin: -80px 0 0 -80px;
  z-index: 30;
  pointer-events: none;
}

.ic-reels-dbl-heart[hidden] {
  display: none !important;
}

.ic-reels-init-loading,
.ic-reels-error {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #000;
  gap: 14px;
}

.ic-reels-init-loading[hidden],
.ic-reels-error[hidden] {
  display: none !important;
}

.ic-reels-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ic-reels-spin 0.7s linear infinite;
}

.ic-reels-error-brand {
  font-size: 18px;
  color: #fff;
  font-family: "IRANYekan", Tahoma, sans-serif;
}

.ic-reels-retry {
  border: 0;
  border-radius: 12px;
  background: #4e91e6;
  color: #fff;
  padding: 10px 22px;
  font-size: 12px;
  cursor: pointer;
  font-family: "IRANYekan", Tahoma, sans-serif;
}

/* Comments sheet */
.ic-reels-cmt-sheet {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.ic-reels-cmt-sheet[hidden] {
  display: none !important;
}

.ic-reels-cmt-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.45);
  cursor: pointer;
}

.ic-reels-cmt-panel {
  position: relative;
  z-index: 1;
  height: min(80dvh, 80%);
  background: #fff;
  border-radius: 18px 18px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #2d3a4a;
  animation: ic-reels-sheet-in 0.28s ease;
}

@keyframes ic-reels-sheet-in {
  from { transform: translateY(40%); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

.ic-reels-cmt-handle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 20px 16px 18px;
  border-bottom: 1px solid #eee;
}

.ic-reels-cmt-handle-bar {
  position: absolute;
  top: 10px;
  left: 50%;
  width: 42px;
  height: 4px;
  margin-left: -21px;
  border-radius: 2px;
  background: #d8dde8;
}

.ic-reels-cmt-title {
  font-size: 13px;
  color: #2d3a4a;
  font-family: "IRANYekan", Tahoma, sans-serif;
  margin-top: 6px;
}

.ic-reels-cmt-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
}

.ic-reels-cmt-body .ic-cmt {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px 8px;
}

.ic-reels-cmt-body .ic-cmt-composer {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  flex-shrink: 0;
  display: block !important;
  background: #fff;
  border-top: 1px solid #eee;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}

.ic-reels-cmt-body .ic-cmt-composer[hidden] {
  display: block !important;
}

.ic-reels-cmt-body .ic-cmt-divider {
  display: none;
}

.ic-reels-cmt-body .ic-cmt {
  padding: 0;
}

.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-item {
  display: grid;
  grid-template-columns: 45px minmax(0, 1fr);
  column-gap: 6px;
  row-gap: 0;
  align-items: start;
  direction: rtl;
  margin-bottom: 0;
  padding: 16px 16px 0;
  border-bottom: 0;
}

.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-reply,
.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-support {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  column-gap: 6px;
  row-gap: 0;
  align-items: start;
  direction: rtl;
}

.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-top {
  display: contents;
}

.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-avatar-btn {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: start;
  margin-top: 5px;
}

.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-reply .ic-cmt-avatar-btn,
.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-support .ic-cmt-avatar-btn {
  margin-top: 0;
}

.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-avatar:not(.ic-cmt-avatar--reply) {
  width: 45px;
  height: 45px;
  margin: 0;
}

.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-avatar--reply {
  width: 40px;
  height: 40px;
  margin: 0;
}

.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-author-line {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 3px;
  width: 100%;
  margin: 5 0 15px;
  min-width: 0;
  direction: rtl;
  text-align: right;
}

.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-item > .ic-cmt-body,
.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-reply > .ic-cmt-body,
.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-support > .ic-cmt-body {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  margin: 0;
  text-align: right;
  direction: rtl;
  min-width: 0;
}

.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-item > .ic-cmt-support {
  grid-column: 1 / -1;
  margin-top: 12px;
}

.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-item > .ic-cmt-replies {
  grid-column: 1 / -1;
  margin-top: 10px;
  margin-right: 50px;
  padding-right: 10px;
  border-right: 0;
}

.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-author {
  font-size: 11.6px;
  font-weight: 700;
  color: #2d3a4a;
  line-height: 1.2;
  text-align: right;
}

.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-text {
  margin: 0 0 8px;
  font-size: 10.6px;
  color: #2d3a4a;
  line-height: 20px;
  width: 100%;
  text-align: right;
}

.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-footer {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  margin-top: 0;
  gap: 16px;
  direction: rtl;
  text-align: right;
}

.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-time {
  font-size: 9.1px;
  color: #666;
}

.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-reply-btn {
  font-size: 8.6px;
  color: #4e91e6;
}

.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-support-text {
  font-size: 10.6px;
  line-height: 22px;
  color: #2d3a4a;
}

.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-support .ic-cmt-author--reply {
  font-size: 10.8px;
}

.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-reply-expert-btn {
  font-size: 8.6px;
}

.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-replies--toggle-only {
  margin-top: 10px;
  margin-right: 50px;
}

.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-toggle-replies {
  margin-right: 0;
}

.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-reply {
  margin-bottom: 16px;
}

.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-badge--main {
  margin-top: -4px;
  margin-right: 3px;
}

.ic-reels-cmt-body .ic-cmt--reels .ic-cmt-badge--reply {
  margin-top: -2px;
  margin-right: 0;
}

/* Category modal — moved to shared/reels-category.css */
