/* JustFun - Neon Rose Theme (inspired by himarts.com) */
:root {
  --bg: #0b1326;
  --bg-sidebar: #131b2e;
  --bg-hover: #1a2235;
  --bg-active: #222a3d;
  --text: #f0e6f0;
  --text-secondary: #a8909c;
  --text-muted: #7a6a75;
  --accent: #ffafd3;
  --accent-hover: #ff8dc1;
  --border: rgba(84, 66, 73, 0.2);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

a { color: inherit; text-decoration: none; }

/* ===== LAYOUT ===== */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* ===== LEFT SIDEBAR - REDGIFS STYLE ===== */
.sidebar {
  width: 240px;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
}

.sidebar-logo {
  padding: 24px 20px 32px;
}

.sidebar-logo a {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.5px;
  text-transform: uppercase;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 500;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-item.active {
  background: var(--bg-active);
  color: var(--text);
  border-left-color: var(--accent);
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* Sidebar Footer - Legal Links */
.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.legal-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.legal-link {
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s;
}

.legal-link:hover {
  color: var(--text-secondary);
}

/* ===== MAIN VIDEO AREA ===== */
.video-container {
  flex: 1;
  height: 100vh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  background: var(--bg);
}

.video-container::-webkit-scrollbar {
  display: none;
}

/* ===== VIDEO SLIDE ===== */
.video-slide {
  height: 100vh;
  width: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: var(--bg);
}

.video-wrapper {
  position: relative;
  height: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-player {
  max-height: 100vh;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  background: #000;
  cursor: pointer;
}

/* 隐藏原生控件 */
.video-player::-webkit-media-controls {
  display: none !important;
}
.video-player::-webkit-media-controls-enclosure {
  display: none !important;
}

/* 加载动画 - Logo */
.video-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 15;
  opacity: 0;
  transition: opacity 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.video-wrapper.loading .video-loading {
  opacity: 1;
}

.loading-logo {
  width: 160px;
  height: auto;
  animation: pulse 1.5s ease-in-out infinite;
}

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

/* 播放/暂停指示器 */
.play-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 80px;
  height: 80px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15;
  pointer-events: none;
  transition: transform 0.15s ease, opacity 0.15s ease;
  opacity: 0;
}

.play-indicator.show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.play-indicator svg {
  width: 32px;
  height: 32px;
  fill: white;
  margin-left: 4px;
}

.play-indicator.paused svg {
  margin-left: 0;
}

/* ===== VIDEO INFO OVERLAY ===== */
.video-info {
  position: absolute;
  bottom: 100px;
  left: 24px;
  right: 120px;
  z-index: 10;
  text-shadow: 0 2px 8px rgba(0,0,0,0.9);
}

.video-creator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.creator-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #ff8a80);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.creator-name {
  font-weight: 600;
  font-size: 17px;
}

.creator-name:hover {
  text-decoration: underline;
}

.video-title {
  font-size: 15px;
  line-height: 1.5;
  max-width: 500px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}

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

.video-tag {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

.video-tag:hover {
  color: var(--accent);
}

/* ===== RIGHT SIDE ACTIONS ===== */
.video-actions {
  position: absolute;
  right: 20px;
  bottom: 140px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 10;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.15s;
  position: relative;
}

.action-btn:hover {
  transform: scale(1.1);
}

.action-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.1);
  transition: all 0.15s;
}

.action-icon svg {
  width: 24px;
  height: 24px;
  fill: white;
}

.action-btn:hover .action-icon {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.2);
}

/* 点赞激活状态 */
.action-btn.liked .like-icon {
  background: var(--accent);
  border-color: var(--accent);
}

.action-btn.liked .like-icon svg {
  fill: white;
}

.action-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

/* 更多菜单 */
.more-menu {
  position: absolute;
  right: 60px;
  top: 0;
  background: rgba(20, 20, 30, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 12px;
  padding: 8px 0;
  min-width: 140px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateX(10px);
  transition: all 0.2s ease;
  z-index: 100;
}

.more-btn:hover .more-menu,
.more-menu:hover {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

.more-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}

.more-item:hover {
  background: rgba(255,255,255,0.1);
}

.more-item svg {
  width: 18px;
  height: 18px;
  fill: var(--text-secondary);
}

/* ===== PROGRESS BAR ===== */
.progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255,255,255,0.15);
  z-index: 20;
  cursor: pointer;
  transition: height 0.15s ease;
}

/* 扩大点击区域 - 用伪元素 */
.progress-bar::before {
  content: '';
  position: absolute;
  top: -20px;
  left: 0;
  right: 0;
  bottom: -10px;
  cursor: pointer;
}

.progress-bar:hover {
  height: 8px;
}

/* 缓冲进度 - 主色半透明 */
.progress-buffer {
  position: absolute;
  height: 100%;
  background: rgba(255, 175, 211, 0.4); /* Neon Rose 40% */
  width: 0%;
  transition: width 0.3s ease;
}

/* 播放进度 - 主色实色 */
.progress-fill {
  position: absolute;
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.1s linear;
}

/* 进度条拖动手柄 */
.progress-handle {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  transition: transform 0.15s ease;
  pointer-events: none;
}

.progress-bar:hover .progress-handle {
  transform: translate(-50%, -50%) scale(1);
}

/* ===== SCROLL HINT ===== */
.scroll-hint {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  animation: bounce 2s infinite;
  z-index: 10;
}

.scroll-hint svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
  40% { transform: translateX(-50%) translateY(-8px); }
  60% { transform: translateX(-50%) translateY(-4px); }
}

/* ===== EXPLORE PAGE ===== */
.explore-container {
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg);
}

.explore-header {
  margin-bottom: 24px;
}

.explore-title {
  font-size: 28px;
  font-weight: 700;
}

.explore-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.explore-card {
  aspect-ratio: 9/16;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.explore-card:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.explore-card img,
.explore-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.explore-card-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 48px 12px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
}

.explore-card-title {
  font-size: 13px;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.explore-card-creator {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ===== LOGIN PAGE ===== */
.login-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.login-box {
  width: 100%;
  max-width: 400px;
  padding: 48px 40px;
  background: #111;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.login-title {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}

.login-subtitle {
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 32px;
  font-size: 15px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-input {
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid #333;
  background: #1a1a1a;
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
}

.login-input:focus {
  border-color: var(--accent);
}

.login-input::placeholder {
  color: var(--text-muted);
}

.login-btn {
  padding: 14px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 8px;
}

.login-btn:hover {
  background: var(--accent-hover);
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #333;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  color: var(--text-secondary);
  font-size: 14px;
}

.login-footer a {
  color: var(--accent);
  font-weight: 500;
}

.login-footer a:hover {
  text-decoration: underline;
}

/* ===== LEGAL PAGE ===== */
.legal-container {
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  padding: 40px;
  background: var(--bg);
}

.legal-content {
  max-width: 800px;
  margin: 0 auto;
}

.legal-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
}

.legal-updated {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 32px;
}

.legal-section {
  margin-bottom: 32px;
}

.legal-section h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.legal-section p,
.legal-section li {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 12px;
}

.legal-section ul {
  padding-left: 24px;
  margin-bottom: 16px;
}

.legal-section a {
  color: var(--accent);
}

.legal-section a:hover {
  text-decoration: underline;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .sidebar {
    width: 72px;
  }
  
  .sidebar-logo {
    padding: 20px 0;
    text-align: center;
  }
  
  .sidebar-logo a {
    font-size: 20px;
  }
  
  .nav-item {
    flex-direction: column;
    gap: 4px;
    padding: 16px 8px;
    font-size: 11px;
    text-align: center;
    border-left: none;
    border-bottom: 3px solid transparent;
  }
  
  .nav-item.active {
    border-left: none;
    border-bottom-color: var(--accent);
  }
  
  .sidebar-footer {
    padding: 12px 8px;
  }
  
  .legal-links {
    gap: 8px;
  }
  
  .legal-link {
    font-size: 10px;
    text-align: center;
  }
  
  .video-info {
    left: 16px;
    right: 80px;
    bottom: 120px;
  }
  
  .video-actions {
    right: 12px;
    bottom: 160px;
  }
  
  .action-icon {
    width: 46px;
    height: 46px;
    font-size: 22px;
  }
}

@media (max-width: 600px) {
  .sidebar {
    width: 60px;
  }
  
  .sidebar-logo a {
    font-size: 16px;
  }
  
  .nav-item {
    padding: 12px 6px;
    font-size: 10px;
  }
  
  .nav-icon svg {
    width: 20px;
    height: 20px;
  }
}

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px 20px;
  margin-top: 20px;
}

.page-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--bg-hover);
  color: var(--text);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}

.page-btn:hover {
  background: var(--accent);
  color: #000;
}

.page-numbers {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}

.page-num:hover {
  background: var(--bg-active);
  color: var(--text);
}

.page-num.active {
  background: var(--accent);
  color: #000;
}

.page-dots {
  color: var(--text-muted);
  padding: 0 4px;
}

.explore-count {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 8px;
}

@media (max-width: 768px) {
  .pagination {
    flex-wrap: wrap;
    gap: 12px;
  }
  
  .page-numbers {
    order: -1;
    width: 100%;
    justify-content: center;
  }
  
  .page-num {
    width: 36px;
    height: 36px;
    font-size: 13px;
  }
}

/* ===== HIDE DEFAULT ELEMENTS ===== */
.site-header,
.site-footer,
.tagbar {
  display: none !important;
}
