/* ============================================================
   HVIS VIDEO SECTION — prefix: hvis-
   Light theme | Primary: #69636f | Accent: #50bcbe
   ============================================================ */

.hvis-video-section *,
.hvis-video-section *::before,
.hvis-video-section *::after,
.hvis-popup *,
.hvis-popup *::before,
.hvis-popup *::after,
.hvis-popup-backdrop {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --hvis-primary:       #69636f;
  --hvis-primary-light: #f0eef3;
  --hvis-primary-mid:   #d4d0d8;
  --hvis-accent:        #50bcbe;
  --hvis-accent-light:  #e6f8f8;
  --hvis-bg:            #f7f5f9;
  --hvis-bg-card:       #ffffff;
  --hvis-bg-card2:      #f0eef3;
  --hvis-text:          #2e2b33;
  --hvis-text-muted:    #69636f;
  --hvis-border:        #d4d0d8;
  --hvis-radius:        14px;
  --hvis-transition:    0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Section wrapper ────────────────────────────────────────── */
.hvis-video-section {
  font-family: 'Vazirmatn', 'Tahoma', sans-serif;
  direction: rtl;
  background: var(--hvis-bg);
  padding: 72px 0 88px;
  overflow: hidden;
}

/* ── Container ──────────────────────────────────────────────── */
.hvis-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Section header ─────────────────────────────────────────── */
.hvis-section-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 44px;
}

.hvis-section-title {
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  font-weight: 800;
  color: var(--hvis-primary);
  margin-bottom: 10px;
  font-family: iransans-light;
}

.hvis-section-subtitle {
  color: var(--hvis-text-muted);
  font-size: 0.93rem;
  font-family: iransans-light;
}

/* ── Tabs ───────────────────────────────────────────────────── */
.hvis-tabs {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--hvis-bg-card);
  border: 1.5px solid var(--hvis-border);
  border-radius: 50px;
  padding: 5px;
  gap: 2px;
  margin: 0 auto 44px;
}

.hvis-tab-indicator {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 5px;
  border-radius: 50px;
  background: var(--hvis-accent);
  transition: left var(--hvis-transition), width var(--hvis-transition);
  z-index: 0;
}

.hvis-tab-btn {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 22px;
  border: none;
  background: transparent;
  color: var(--hvis-primary);
  font-family: inherit;
  font-size: 0.87rem;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  transition: color var(--hvis-transition);
  white-space: nowrap;
  user-select: none;
  font-family: iransans-light;
}

.hvis-tab-btn--active {
  color: #ffffff;
}

.hvis-tab-icon {
  font-size: 1rem;
}

/* ── Panels ─────────────────────────────────────────────────── */
.hvis-tab-panel {
  display: none;
}

.hvis-tab-panel--active {
  display: block;
  animation: hvisSlideIn 0.32s ease both;
}

@keyframes hvisSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Grid ───────────────────────────────────────────────────── */
.hvis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}

@media (max-width: 640px) {
  .hvis-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
  }
}

/* ── Reel item ──────────────────────────────────────────────── */
.hvis-reel-item {
  cursor: pointer;
  outline: none;
}

.hvis-reel-item:focus-visible .hvis-reel-thumb {
  outline: 2.5px solid var(--hvis-accent);
  outline-offset: 3px;
}

.hvis-reel-thumb {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: var(--hvis-radius);
  overflow: hidden;
  background: var(--hvis-bg-card2);
  border: 1.5px solid var(--hvis-border);
  box-shadow: 0 2px 12px rgba(105, 99, 111, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.hvis-reel-item:hover .hvis-reel-thumb {
  transform: translateY(-5px);
  box-shadow: 0 12px 32px rgba(80, 188, 190, 0.18);
  border-color: var(--hvis-accent);
}

.hvis-reel-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.hvis-reel-item:hover .hvis-reel-thumb img {
  transform: scale(1.06);
}

/* Overlay — visible on hover */
.hvis-reel-overlay {
  position: absolute;
  inset: 0;
  background: rgba(105, 99, 111, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.hvis-reel-item:hover .hvis-reel-overlay {
  opacity: 1;
}

/* Play button */
.hvis-play-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--hvis-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(80, 188, 190, 0.4);
  transition: transform 0.2s ease;
}

.hvis-reel-item:hover .hvis-play-btn {
  transform: scale(1.1);
}

.hvis-play-btn svg {
  width: 18px;
  height: 18px;
  color: #ffffff;
  margin-right: -2px;
}

/* Views badge */
.hvis-reel-views {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(105, 99, 111, 0.7);
  padding: 4px 10px;
  border-radius: 20px;
  font-family: iransans-light;
}

.hvis-reel-views svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* Title below card */
.hvis-reel-title {
  margin-top: 9px;
  font-size: 0.8rem;
  color: var(--hvis-text-muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s;
  font-family: iransans-light;
}

.hvis-reel-item:hover .hvis-reel-title {
  color: var(--hvis-accent);
}

/* ============================================================
   POPUP
   ============================================================ */

.hvis-popup-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(105, 99, 111, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.hvis-popup-backdrop.hvis-is-open {
  opacity: 1;
  pointer-events: all;
}

/* Popup shell */
.hvis-popup {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.92) translateY(16px);
  transition: opacity 0.32s ease, transform 0.32s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.hvis-popup.hvis-is-open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: all;
}

/* Inner box */
.hvis-popup-inner {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: min(860px, 95vw);
  max-height: 88vh;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(105, 99, 111, 0.25);
  border: 1.5px solid var(--hvis-border);
  background: var(--hvis-bg-card);
}

/* Close button */
.hvis-popup-close {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--hvis-border);
  background: var(--hvis-bg-card);
  color: var(--hvis-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.25s;
}

.hvis-popup-close:hover {
  background: #e74c3c;
  border-color: #e74c3c;
  color: #ffffff;
  transform: rotate(90deg);
}

.hvis-popup-close svg {
  width: 15px;
  height: 15px;
}

/* ── Info sidebar ───────────────────────────────────────────── */
.hvis-popup-info {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 36px 24px 28px;
  background: var(--hvis-primary-light);
  border-left: 1.5px solid var(--hvis-border);
}

.hvis-popup-logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--hvis-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  display: none;
}

.hvis-popup-logo svg {
  width: 20px;
  height: 20px;
  color: #ffffff;
}

.hvis-popup-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--hvis-text);
  line-height: 1.6;
  text-align: right;
}

.hvis-popup-views-row {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--hvis-text-muted);
  font-size: 0.82rem;
  display: none;
}

.hvis-popup-views-row svg {
  color: var(--hvis-accent);
  flex-shrink: 0;
}

.hvis-aparat-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: auto;
  padding: 10px 18px;
  background: var(--hvis-accent);
  color: #ffffff;
  text-decoration: none;
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 700;
  transition: background 0.2s, transform 0.2s;
  align-self: flex-start;
  white-space: nowrap;
  display: none;
}

.hvis-aparat-link:hover {
  background: var(--hvis-primary);
  transform: translateY(-2px);
}

/* ── Video player ───────────────────────────────────────────── */
.hvis-popup-player {
  position: relative;
  flex: 1 1 auto;
  aspect-ratio: 16 / 9;
  background: var(--hvis-bg-card2);
  min-height: 0;
}

.hvis-popup-player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Loader */
.hvis-popup-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--hvis-bg-card2);
  z-index: 2;
  color: var(--hvis-text-muted);
  font-size: 0.82rem;
}

.hvis-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--hvis-primary-mid);
  border-top-color: var(--hvis-accent);
  border-radius: 50%;
  animation: hvis-spin 0.75s linear infinite;
}

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

/* ── Responsive popup ───────────────────────────────────────── */
@media (max-width: 620px) {
  .hvis-popup-inner {
    flex-direction: column-reverse;
    width: min(400px, 95vw);
    max-height: 90vh;
    overflow-y: auto;
  }

  .hvis-popup-info {
    flex: 0 0 auto;
    border-left: none;
    border-top: 1.5px solid var(--hvis-border);
    padding: 20px 20px 24px;
  }

  .hvis-popup-player {
    aspect-ratio: 14 / 9;
    flex: 0 0 auto;
    width: 100%;
  }
}

/* ── Responsive tabs ────────────────────────────────────────── */
@media (max-width: 580px) {
  .hvis-tabs {
    flex-direction: column;
    border-radius: 16px;
    gap: 3px;
    padding: 5px;
    width: 100%;
  }
  .hvis-tab-indicator {
    display: none;
  }
  .hvis-tab-btn {
    width: 100%;
    border-radius: 12px;
    justify-content: center;
    padding: 11px 18px;
  }
  .hvis-tab-btn--active {
    background: var(--hvis-accent);
    color: #ffffff;
  }
}
