/* Vertical Video Scroll - TikTok/Reels-style vertical scrolling video feed
 * Implements snap-scrolling, full-screen video containers, smooth scrolling,
 * touch gestures, video positioning, and mobile-optimized scroll behavior
 *END_DESCRIPTION
 */

/* TikTok/Reels-style Vertical Video Scrolling */

.mobile-video-app {
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height excludes browser UI */
  overflow: hidden;
  position: relative;
  background: #000;
}

.video-scroll-container {
  height: calc(100vh - var(--mobile-header-height, var(--header-height)));
  margin-top: var(--mobile-header-height, var(--header-height));
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  /* Allow video elements to be touchable */
  touch-action: pan-y;
  position: relative; /* Required for virtual scrolling absolute positioning */
  /* Performance optimizations for smoother scrolling */
  will-change: scroll-position;
  transform: translateZ(0); /* Force hardware acceleration */
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  perspective: 1000px;
  -webkit-perspective: 1000px;
}

.video-scroll-container::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.video-slide {
  min-height: calc(100vh - var(--mobile-header-height, var(--header-height)));
  min-height: calc(100dvh - var(--mobile-header-height, var(--header-height)));
  max-height: calc(100vh - var(--mobile-header-height, var(--header-height)));
  max-height: calc(100dvh - var(--mobile-header-height, var(--header-height)));
  width: 100vw;
  position: relative;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  background: var(--mobile-bg);
  overflow: hidden;
  /* Performance optimizations */
  contain: layout style paint;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.video-player {
  position: relative;
  width: 100%;
  height: 60vh; /* Fixed height for video */
  height: 60dvh; /* Use dynamic viewport height to exclude browser UI */
  z-index: 1;
  flex-shrink: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-element {
  width: 100%;
  height: 100%;
  object-fit: cover;
  max-height: 60vh;
  background: #000;
  /* Ensure video is clickable on mobile */
  touch-action: manipulation;
  pointer-events: auto;
  z-index: 10;
  position: relative;
}

.video-element iframe {
  width: 100%;
  height: 100%;
  border: none;
  touch-action: manipulation;
  pointer-events: auto;
  z-index: 10;
}

/* Mobile Header */
.mobile-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 100;
  background: linear-gradient(180deg, rgba(11, 21, 31, 0.95) 0%, rgba(11, 21, 31, 0.7) 40%, rgba(11, 21, 31, 0.3) 70%, rgba(0,0,0,0) 100%);
  padding: env(safe-area-inset-top, 20px) 16px 16px 16px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-sizing: border-box;
}

.nav-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.nav-tab {
  padding: 8px 16px;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.nav-tab.active {
  color: #000;
}

.nav-tab.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Override any conflicting search-btn styles - use header-item styling instead */
.search-btn {
  /* Reset any absolute positioning */
  position: static !important;
  /* Remove any circular background styling */
  background: none !important;
  border-radius: 0 !important;
  width: auto !important;
  height: auto !important;
  /* Remove any transform positioning */
  transform: none !important;
  top: auto !important;
  right: auto !important;
  /* Remove backdrop filters */
  backdrop-filter: none !important;
}

.search-btn:hover {
  background: none !important;
  transform: scale(1.05) !important;
}

.video-actions-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

.video-actions-overlay > * {
  pointer-events: auto;
}

/* Right Side Actions */
.actions-right {
  position: absolute;
  right: 12px;
  bottom: 140px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.action-btn {
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  position: relative;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.action-btn:active {
  transform: scale(0.95);
}

.action-btn.clicked {
  animation: actionBtnClick 0.3s ease;
}

@keyframes actionBtnClick {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.action-btn svg {
  width: 28px;
  height: 28px;
  margin-bottom: 2px;
}

.action-count {
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  min-height: 14px;
}

.like-action-btn.active {
  color: white;
}

.like-action-btn.active svg {
  fill: currentColor;
}

.dislike-action-btn.active {
  background: rgba(128, 128, 128, 0.8);
  color: white;
}

.dislike-action-btn.active svg {
  fill: currentColor;
}

.action-btn.hovered {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

/* Bottom Info */
.video-info-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 80px;
  padding: 20px;
  background: linear-gradient(0deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 50%, rgba(0,0,0,0) 100%);
  color: white;
  pointer-events: none;
}

.video-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-description {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.video-tag {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.video-trend-score {
  margin: 8px 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
}

.trend-label {
  color: rgba(255, 255, 255, 0.6);
}

.trend-value {
  color: #4dabf7;
  font-weight: 600;
}

.video-additional-info {
  margin-top: 8px;
}

.info-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.8);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  margin-right: 8px;
  margin-bottom: 4px;
  display: inline-block;
}

.info-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  transform: translateY(-1px);
}

/* Loading States */
.video-slide.loading {
  background: #000;
}

.video-slide.loading::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 20;
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* No Videos State */
.no-videos {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: white;
  background: #000;
}

.no-videos h2 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 16px;
  color: white;
}

.no-videos p {
  font-size: 16px;
  opacity: 0.8;
  margin-bottom: 24px;
  line-height: 1.5;
  max-width: 300px;
}

.clear-filters-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.clear-filters-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

/* TRW Auth Required */
.trw-auth-required {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #000;
}

.auth-message-card {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 40px 30px;
  text-align: center;
  max-width: 400px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.auth-message-card h2 {
  color: white;
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 16px;
}

.auth-message-card p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 24px;
}

.connect-trw-btn {
  display: inline-block;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 14px 28px;
  border-radius: 25px;
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.connect-trw-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
  text-decoration: none;
  color: white;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .actions-right {
    right: 8px;
    bottom: 120px;
  }
  
  .action-btn {
    width: 48px;
    height: 48px;
  }
  
  .action-btn svg {
    width: 24px;
    height: 24px;
  }
  
  .video-info-bottom {
    right: 64px;
    padding: 16px;
  }
  
  .video-title {
    font-size: 14px;
  }
  
  .video-description {
    font-size: 13px;
  }
}

/* Comments Panel */
.comments-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 70vh;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px 20px 0 0;
  z-index: 200;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.comments-panel.open {
  transform: translateY(0);
}

.comments-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.comments-panel-handle {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.comments-panel-title {
  color: white;
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.comments-close-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 24px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.comments-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.comments-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 20px 20px;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.comment-item {
  display: flex;
  gap: 12px;
  color: white;
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.comment-body {
  flex: 1;
}

.comment-author {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.comment-text {
  font-size: 14px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.9);
}

.comment-time {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 4px;
}

.comments-form {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.8);
  flex-shrink: 0;
}

.comment-input-container {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.comment-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 10px 16px;
  color: white;
  font-size: 14px;
  resize: none;
  max-height: 80px;
  min-height: 40px;
}

.comment-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.comment-submit-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 20px;
  color: white;
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 40px;
}

.comment-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.comment-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.no-comments {
  text-align: center;
  padding: 40px 20px;
  color: rgba(255, 255, 255, 0.6);
}

.no-comments-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* Transcript Panel - same height as video content wrapper (remaining space in video-slide) */
.transcript-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 58vh;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px 20px 0 0;
  z-index: 200;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.transcript-panel.open {
  transform: translateY(0);
}

.transcript-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.transcript-panel-handle {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.transcript-panel-title {
  color: white;
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.transcript-close-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 24px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.transcript-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.transcript-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  color: white;
  line-height: 1.6;
  font-size: 16px;
}

.transcript-text {
  white-space: pre-wrap;
}

/* Categories Panel */
.categories-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80vh;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px 20px 0 0;
  z-index: 200;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.categories-panel.open {
  transform: translateY(0);
}

.categories-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.categories-panel-handle {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.categories-panel-title {
  color: white;
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.categories-close-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 24px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.categories-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.categories-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.categories-section {
  margin-bottom: 30px;
}

.categories-section h4 {
  color: white;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

.current-categories,
.available-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.category-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 8px 16px;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.category-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

.category-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: #667eea;
}

.category-add {
  font-size: 16px;
  font-weight: bold;
}

.new-category-form {
  display: flex;
  gap: 12px;
  align-items: center;
}

.new-category-form input {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 10px 16px;
  color: white;
  font-size: 14px;
}

.new-category-form input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.add-btn {
  background: #ecc879;
  border: none;
  border-radius: 20px;
  color: #0d1824;
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.add-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(236, 200, 121, 0.3);
}

/* Settings Panel */
.settings-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 85vh;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px 20px 0 0;
  z-index: 200;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.settings-panel.open {
  transform: translateY(0);
}

.settings-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.settings-panel-handle {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.settings-panel-title {
  color: white;
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.settings-close-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 24px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.settings-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.settings-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.settings-section {
  margin-bottom: 30px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 20px;
}

.settings-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.settings-section h4 {
  color: white;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.filter-group {
  margin-bottom: 20px;
}

.filter-group label {
  display: block;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  margin-bottom: 8px;
  font-weight: 500;
}

.tag-selector {
  position: relative;
  display: flex;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.tag-display {
  flex: 1;
  padding: 12px 16px;
  color: white;
  cursor: pointer;
  min-height: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tag-display .placeholder {
  color: rgba(255, 255, 255, 0.6);
  font-style: italic;
}

.tag-selector-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  padding: 12px 16px;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tag-selector-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.tag-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.tag-search {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: white;
  font-size: 14px;
}

.tag-search::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.tag-option {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: white;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.tag-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.selected-tag {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.remove-tag {
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
}

.filter-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.apply-filters-btn,
.clear-filters-btn {
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.apply-filters-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.apply-filters-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.clear-filters-btn {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.clear-filters-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.setting-item {
  margin-bottom: 16px;
}

.setting-item label {
  display: flex;
  align-items: center;
  gap: 12px;
  color: white;
  cursor: pointer;
  font-size: 14px;
}

.setting-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #667eea;
}

/* Tag Filter Specific Styles */
.filter-tags-display {
  min-height: 40px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-start;
}

.filter-tags-display:empty::before {
  content: 'No tags selected';
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
}

.tag-search-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 14px;
  margin-bottom: 16px;
}

.tag-search-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.tag-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 20px;
  padding: 8px 0;
}

.tag-filter-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.8);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tag-filter-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.tag-filter-btn.include {
  background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
  border-color: #4caf50;
  color: white;
}

.tag-filter-btn.exclude {
  background: linear-gradient(135deg, #f44336 0%, #ef5350 100%);
  border-color: #f44336;
  color: white;
}

.filter-tag {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.filter-tag.include-tag {
  background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
}

.filter-tag.exclude-tag {
  background: linear-gradient(135deg, #f44336 0%, #ef5350 100%);
}

/* Category Tag Styles for Mini Display */
.category-tag-mini {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 2px;
}

.remove-category-mini-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.remove-category-mini-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.no-categories-mini {
  color: rgba(255, 255, 255, 0.6);
  font-style: italic;
  font-size: 14px;
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
  .video-scroll-container {
    -webkit-overflow-scrolling: touch;
  }
  
  .mobile-header {
    padding-top: max(env(safe-area-inset-top), 20px);
  }
  
  .comments-content {
    -webkit-overflow-scrolling: touch;
  }
  
  .transcript-content {
    -webkit-overflow-scrolling: touch;
  }
}

/* Viral Video Button Styles */
.viral-btn {
  background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
  border: none;
  color: white;
  font-weight: bold;
  position: relative;
  overflow: hidden;
  animation: pulse-glow 2s ease-in-out infinite;
}

.viral-btn::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
  transform: rotate(45deg);
  animation: shimmer 3s linear infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 107, 107, 0.5); }
  50% { box-shadow: 0 0 20px rgba(255, 107, 107, 0.8), 0 0 30px rgba(255, 142, 83, 0.5); }
}

@keyframes shimmer {
  0% { transform: translateX(-100%) rotate(45deg); }
  100% { transform: translateX(100%) rotate(45deg); }
}

.viral-btn:hover {
  background: linear-gradient(135deg, #ff8e53 0%, #ff6b6b 100%);
  transform: scale(1.05);
}

/* Viral Video Modal */
.viral-video-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.viral-modal-content {
  background: #1a1a1a;
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

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

.viral-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 2px solid #ff6b6b;
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.1) 0%, rgba(255, 142, 83, 0.1) 100%);
}

.viral-modal-header h3 {
  margin: 0;
  font-size: 24px;
  color: white;
}

.viral-close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 32px;
  cursor: pointer;
  line-height: 1;
  transition: transform 0.2s ease;
}

.viral-close-btn:hover {
  transform: scale(1.2);
  color: #ff6b6b;
}

.viral-stats {
  padding: 15px 20px;
  text-align: center;
  font-size: 18px;
  color: #ff8e53;
  font-weight: bold;
}

.viral-counter {
  text-align: center;
  padding: 10px 20px;
  font-size: 14px;
  color: #aaa;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.viral-video-container {
  padding: 0 20px 20px;
  position: relative;
}

.viral-instagram-video {
  width: 100%;
  max-height: 600px;
  border-radius: 8px;
  background: black;
}

.viral-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid rgba(255, 107, 107, 0.8);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
  font-size: 20px;
}

.viral-nav-btn:hover:not(.disabled) {
  background: rgba(255, 107, 107, 0.9);
  border-color: #ff6b6b;
  transform: translateY(-50%) scale(1.1);
}

.viral-nav-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.2);
}

.viral-nav-prev {
  left: 10px;
}

.viral-nav-next {
  right: 10px;
}

.viral-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff6b6b;
  color: white;
  font-size: 10px;
  font-weight: bold;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border: 2px solid #1a1a1a;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.viral-caption {
  padding: 15px 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  margin: 15px 20px 0;
}

.viral-caption-label {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.viral-caption-text {
  color: #ddd;
  font-size: 16px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.viral-actions {
  padding: 20px;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.view-on-instagram-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: bold;
  font-size: 16px;
  transition: transform 0.2s ease;
}

.view-on-instagram-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(240, 148, 51, 0.4);
}

/* Mobile specific viral button */
@media (max-width: 768px) {
  .content-action-btn.viral-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .content-action-btn.viral-btn i {
    font-size: 20px;
  }

  .viral-modal-content {
    width: 90%;
    max-width: 400px;
    max-height: 70vh;
  }

  .viral-modal-header {
    padding: 15px;
  }

  .viral-modal-header h3 {
    font-size: 18px;
  }

  .viral-stats {
    padding: 10px 15px;
    font-size: 16px;
  }

  .viral-counter {
    padding: 8px 15px;
    font-size: 12px;
  }

  .viral-video-container {
    padding: 0 15px 15px;
  }

  .viral-nav-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .viral-nav-prev {
    left: 5px;
  }

  .viral-nav-next {
    right: 5px;
  }

  .viral-count {
    font-size: 9px;
    min-width: 16px;
    height: 16px;
  }

  .viral-instagram-video {
    max-height: 45vh;
    max-width: 100%;
    object-fit: contain;
  }

  .viral-caption {
    padding: 12px 15px;
    margin: 10px 15px 0;
  }

  .viral-caption-label {
    font-size: 14px;
    margin-bottom: 6px;
  }

  .viral-caption-text {
    font-size: 14px;
  }

  .viral-actions {
    padding: 15px;
  }

  .view-on-instagram-btn {
    padding: 10px 20px;
    font-size: 14px;
  }
}

/* Scale down for short devices (small height) */
@media (max-height: 700px) {
  /* Reduce video player height significantly */
  .video-player {
    height: 45vh;
  }

  .video-element {
    max-height: 45vh;
  }

  /* Smaller buttons */
  .action-btn {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  /* Smaller fonts */
  .video-title {
    font-size: 13px;
  }

  .video-description {
    font-size: 11px;
  }

  /* Minimal padding */
  .video-actions-overlay {
    padding: 8px;
    gap: 8px;
  }

  .action-btn-label {
    font-size: 10px;
  }

  /* Very compact mobile header */
  .mobile-header {
    padding: 8px 10px;
  }

  .header-top-row {
    gap: 6px;
  }

  .app-title {
    font-size: 14px;
  }

  .header-icon-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  /* Minimal feed tabs */
  .header-feed-nav {
    gap: 4px;
    padding: 4px 10px;
  }

  .feed-tab {
    padding: 5px 10px;
    font-size: 11px;
  }
}

/* Even more compact for very short devices */
@media (max-height: 600px) {
  .video-player {
    height: 40vh;
  }

  .video-element {
    max-height: 40vh;
  }

  .action-btn {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }

  .video-actions-overlay {
    padding: 6px;
    gap: 6px;
  }

  .mobile-header {
    padding: 6px 8px;
  }

  .header-icon-btn {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .feed-tab {
    padding: 4px 8px;
    font-size: 10px;
  }
}

/* Ultra compact for iPhone SE and similar (375x667) */
@media (max-height: 670px) {
  .video-player {
    height: 35vh;
  }

  .video-element {
    max-height: 35vh;
  }

  .action-btn {
    width: 36px;
    height: 36px;
    font-size: 15px;
  }

  .action-btn-label {
    font-size: 9px;
  }

  .video-actions-overlay {
    padding: 4px;
    gap: 4px;
  }

  .mobile-header {
    padding: 4px 6px;
  }

  .header-top-row {
    gap: 4px;
  }

  .app-title {
    font-size: 12px;
  }

  .header-icon-btn {
    width: 26px;
    height: 26px;
    font-size: 11px;
  }

  .header-feed-nav {
    gap: 3px;
    padding: 3px 6px;
  }

  .feed-tab {
    padding: 3px 6px;
    font-size: 9px;
  }

  .video-title {
    font-size: 12px;
  }

  .video-description {
    font-size: 10px;
  }
}
