/*
Theme Name: TikFlow
Theme URI: https://example.com/tiktflow
Author: TikFlow Theme
Author URI: https://example.com
Description: A TikTok-inspired WordPress theme with vertical full-screen video feed, swipe navigation, likes, comments, and share actions. Perfect for video-first content creators and communities.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: tiktflow
Tags: video, full-screen, dark, social, tiktok, feed, modern
*/

/* ============================================
   TIKTOW — GLOBAL RESET & VARIABLES
   ============================================ */
:root {
  --bg-primary: #000000;
  --bg-surface: #111111;
  --bg-card: #1a1a1a;
  --accent: #fe2c55;
  --accent-blue: #25f4ee;
  --text-primary: #ffffff;
  --text-secondary: rgba(255,255,255,0.75);
  --text-muted: rgba(255,255,255,0.45);
  --border: rgba(255,255,255,0.12);
  --overlay-dark: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.3) 40%, transparent 70%);
  --font-main: 'Sora', sans-serif;
  --sidebar-width: 72px;
  --action-bar-width: 72px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  overflow: hidden;
  height: 100%;
  width: 100%;
}

body.wp-admin {
  overflow: auto;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; color: inherit; font-family: inherit; }
img { display: block; max-width: 100%; }

/* ============================================
   SCROLLBAR HIDE
   ============================================ */
.feed-container::-webkit-scrollbar { display: none; }
.feed-container { -ms-overflow-style: none; scrollbar-width: none; }

/* ============================================
   LAYOUT SHELL
   ============================================ */
#tiktflow-app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* ============================================
   LEFT SIDEBAR (DESKTOP)
   ============================================ */
.tf-sidebar {
  width: 240px;
  background: var(--bg-primary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  z-index: 100;
  flex-shrink: 0;
  transition: width var(--transition);
}

.tf-sidebar .logo {
  padding: 0 20px 24px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.tf-sidebar .logo span {
  color: var(--accent);
}

.tf-nav {
  flex: 1;
  padding: 0 12px;
}

.tf-nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 12px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  cursor: pointer;
  margin-bottom: 2px;
}

.tf-nav-item:hover,
.tf-nav-item.active {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
}

.tf-nav-item.active .nav-icon {
  color: var(--accent);
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.tf-sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ============================================
   MAIN FEED AREA
   ============================================ */
.tf-main {
  flex: 1;
  display: flex;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.feed-container {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  position: relative;
}

/* ============================================
   VIDEO CARD
   ============================================ */
.video-card {
  width: 100%;
  height: 100vh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  position: relative;
  overflow: hidden;
  background: #000;
}

.video-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

/* Fallback color bg for posts without video */
.video-card-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-overlay {
  position: absolute;
  inset: 0;
  background: var(--overlay-dark);
  pointer-events: none;
}

/* Top progress bar for active video */
.progress-bar-wrap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255,255,255,0.2);
  z-index: 10;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.1s linear;
}

/* Play/pause indicator */
.play-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 72px;
  height: 72px;
  background: rgba(0,0,0,0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  transition: transform 0.15s ease, opacity 0.3s ease;
  opacity: 0;
  z-index: 20;
  pointer-events: none;
}

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

/* ============================================
   VIDEO CARD — BOTTOM INFO
   ============================================ */
.video-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: var(--action-bar-width);
  padding: 20px 16px 28px;
  z-index: 10;
}

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

.author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.5);
  background: var(--bg-card);
}

.author-avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  border: 2px solid rgba(255,255,255,0.4);
  flex-shrink: 0;
}

.author-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.author-handle {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  margin-top: 1px;
}

.follow-btn-inline {
  margin-left: auto;
  padding: 5px 14px;
  border-radius: 4px;
  border: 1.5px solid #fff;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: transparent;
  transition: all var(--transition);
  white-space: nowrap;
}

.follow-btn-inline:hover,
.follow-btn-inline.following {
  background: var(--accent);
  border-color: var(--accent);
}

.video-caption {
  font-size: 14px;
  line-height: 1.55;
  color: rgba(255,255,255,0.92);
  margin-bottom: 10px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-caption.expanded {
  -webkit-line-clamp: unset;
}

.caption-more {
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  cursor: pointer;
  display: inline;
}

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

.video-tag {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-blue);
  text-shadow: 0 0 8px rgba(37,244,238,0.4);
}

.video-sound {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: rgba(255,255,255,0.8);
}

.sound-icon {
  font-size: 14px;
  animation: spin 4s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ============================================
   ACTION BAR (RIGHT SIDE)
   ============================================ */
.action-bar {
  position: absolute;
  bottom: 20px;
  right: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  z-index: 10;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: transform var(--transition);
}

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

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

.action-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  transition: all var(--transition);
  border: 1px solid rgba(255,255,255,0.1);
}

.action-btn.liked .action-icon {
  background: rgba(254,44,85,0.2);
  border-color: var(--accent);
  color: var(--accent);
}

.action-count {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Avatar action (profile pic on right) */
.action-avatar {
  position: relative;
  margin-bottom: 4px;
}

.action-avatar img,
.action-avatar .action-av-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
}

.action-av-placeholder {
  background: linear-gradient(135deg, var(--accent), var(--accent-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
}

.follow-dot {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

/* Like pop animation */
@keyframes likePop {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); }
  100% { transform: scale(1); }
}

.like-animate {
  animation: likePop 0.35s ease;
}

/* Heart float on double tap */
.heart-float {
  position: absolute;
  pointer-events: none;
  font-size: 64px;
  z-index: 50;
  animation: floatUp 0.8s ease forwards;
  transform-origin: center;
}

@keyframes floatUp {
  0% { transform: scale(0) rotate(-15deg); opacity: 1; }
  50% { transform: scale(1.2) rotate(5deg); opacity: 1; }
  100% { transform: scale(0.8) translateY(-120px); opacity: 0; }
}

/* ============================================
   TOP NAV BAR (MOBILE + DESKTOP FEED)
   ============================================ */
.tf-top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  padding: 14px 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
}

.tf-top-tabs {
  display: flex;
  gap: 20px;
  align-items: center;
}

.tf-top-tab {
  font-size: 16px;
  font-weight: 600;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  padding-bottom: 4px;
  transition: all var(--transition);
  position: relative;
}

.tf-top-tab.active {
  color: #fff;
}

.tf-top-tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
}

.tf-search-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  cursor: pointer;
}

/* ============================================
   BOTTOM NAV (MOBILE)
   ============================================ */
.tf-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: rgba(0,0,0,0.92);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
}

.tf-bottom-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  max-width: 480px;
  margin: 0 auto;
}

.tf-bn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  padding: 4px 16px;
  min-width: 56px;
  color: rgba(255,255,255,0.55);
  transition: color var(--transition);
}

.tf-bn-item.active { color: #fff; }

.tf-bn-icon { font-size: 22px; }
.tf-bn-label { font-size: 10px; font-weight: 500; }

/* Upload/create button in bottom nav */
.tf-bn-create {
  display: flex;
  align-items: center;
  justify-content: center;
}

.tf-bn-create-inner {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  height: 32px;
}

.tf-bn-create-left {
  background: var(--accent-blue);
  width: 18px;
  height: 32px;
}

.tf-bn-create-center {
  background: #fff;
  color: #000;
  font-size: 20px;
  font-weight: 700;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tf-bn-create-right {
  background: var(--accent);
  width: 18px;
  height: 32px;
}

/* ============================================
   COMMENT DRAWER
   ============================================ */
.comment-drawer {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 480px;
  height: 70vh;
  background: var(--bg-surface);
  border-radius: 16px 16px 0 0;
  z-index: 300;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-top: 1px solid var(--border);
}

.comment-drawer.open {
  transform: translateX(-50%) translateY(0);
}

.comment-drawer-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.comment-drawer-title {
  font-size: 15px;
  font-weight: 700;
}

.comment-close {
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background var(--transition);
}

.comment-close:hover {
  background: rgba(255,255,255,0.1);
}

.comment-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

.comment-list::-webkit-scrollbar { width: 0; }

.comment-item {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

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

.comment-body { flex: 1; }
.comment-author { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.comment-text { font-size: 14px; color: var(--text-secondary); margin-top: 2px; line-height: 1.5; }
.comment-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.comment-input-bar {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

.comment-input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 9px 16px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-main);
  outline: none;
  transition: border-color var(--transition);
}

.comment-input:focus {
  border-color: rgba(255,255,255,0.3);
}

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

.comment-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--transition);
  flex-shrink: 0;
}

.comment-send:hover { background: #e01a40; }

/* ============================================
   SHARE SHEET
   ============================================ */
.share-sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 480px;
  background: var(--bg-surface);
  border-radius: 16px 16px 0 0;
  z-index: 300;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 16px);
}

.share-sheet.open {
  transform: translateX(-50%) translateY(0);
}

.share-sheet-header {
  padding: 14px 16px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 700;
}

.share-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  padding: 20px 12px;
}

.share-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 8px;
  cursor: pointer;
  border-radius: 10px;
  transition: background var(--transition);
}

.share-item:hover { background: rgba(255,255,255,0.06); }

.share-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.share-label { font-size: 11px; color: var(--text-secondary); text-align: center; }

/* ============================================
   OVERLAY BACKDROP
   ============================================ */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 250;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.drawer-backdrop.show {
  opacity: 1;
  pointer-events: all;
}

/* ============================================
   MUTE INDICATOR
   ============================================ */
.mute-indicator {
  position: absolute;
  top: 60px;
  right: 14px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  z-index: 20;
  transition: opacity var(--transition);
}

/* ============================================
   LOADING SKELETON
   ============================================ */
.skeleton-card {
  width: 100%;
  height: 100vh;
  background: #111;
  display: flex;
  align-items: flex-end;
  padding: 24px 16px;
}

@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.shimmer {
  background: linear-gradient(90deg, #1a1a1a 25%, #2a2a2a 50%, #1a1a1a 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.feed-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 16px;
  color: var(--text-muted);
  padding: 24px;
  text-align: center;
}

.feed-empty-icon { font-size: 56px; margin-bottom: 8px; }
.feed-empty h3 { font-size: 20px; font-weight: 700; color: var(--text-secondary); }
.feed-empty p { font-size: 14px; line-height: 1.6; }

/* ============================================
   RIGHT PANEL (SUGGESTED) — DESKTOP
   ============================================ */
.tf-right-panel {
  width: 320px;
  flex-shrink: 0;
  padding: 20px 16px;
  overflow-y: auto;
  display: none;
}

.tf-right-panel::-webkit-scrollbar { width: 0; }

.rp-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.suggested-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.suggested-user:last-child { border-bottom: none; }

.su-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #ff6b35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.su-info { flex: 1; }
.su-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.su-handle { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

.su-follow-btn {
  padding: 6px 14px;
  border-radius: 4px;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
}

.su-follow-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (min-width: 1024px) {
  .tf-right-panel { display: block; }
}

@media (max-width: 768px) {
  .tf-sidebar { display: none; }
  .tf-bottom-nav { display: block; }

  .feed-container {
    padding-bottom: 60px;
  }
}

@media (min-width: 769px) and (max-width: 1023px) {
  .tf-sidebar {
    width: 72px;
  }

  .tf-sidebar .logo { padding: 0 0 24px; text-align: center; }
  .tf-sidebar .logo span:first-child { display: none; }
  .tf-nav-item span:not(.nav-icon) { display: none; }
  .tf-nav-item { justify-content: center; }
  .tf-sidebar-footer { display: none; }
}

/* ============================================
   ADMIN BAR COMPAT
   ============================================ */
@media screen and (min-width: 783px) {
  .wp-admin-bar ~ #tiktflow-app {
    margin-top: 32px;
    height: calc(100vh - 32px);
  }
}
