﻿/* ==========================================================================
   Kids Video Showcase - TikTok-Style Mobile E-Commerce Video Feed
   ========================================================================== */

:root {
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --secondary: #EC4899;
  --accent-green: #10B981;
  --bg-dark: #000000;
  --text-light: #FFFFFF;
  --text-muted: rgba(255, 255, 255, 0.82);
  --glass-bg: rgba(0, 0, 0, 0.5);
  --glass-border: rgba(255, 255, 255, 0.18);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* Background for Desktop / Web version */
html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: #080C14;
  background-image: 
    radial-gradient(circle at 50% 10%, rgba(99, 102, 241, 0.25) 0%, transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(236, 72, 153, 0.2) 0%, transparent 45%),
    radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 28px 28px;
  background-attachment: fixed;
  color: var(--text-light);
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
}

/* ==========================================================================
   Centered Smartphone Frame Container
   ========================================================================== */

.app-viewport-wrapper {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background-color: #000000;
  overflow: hidden;
}

/* Desktop layout (screens wider than 480px) */
@media (min-width: 480px) {
  .app-viewport-wrapper {
    width: 420px;
    height: 92vh;
    height: 92dvh;
    max-height: 890px;
    border-radius: 40px;
    border: 5px solid rgba(255, 255, 255, 0.16);
    box-shadow: 
      0 25px 70px -10px rgba(0, 0, 0, 0.9),
      0 0 35px rgba(79, 70, 229, 0.2),
      0 0 0 1px rgba(255, 255, 255, 0.12);
  }
}

/* ==========================================================================
   Top Navigation Header (Two-Level Rubricator)
   ========================================================================== */

.app-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding-top: calc(var(--safe-top) + 10px);
  padding-bottom: 8px;
  background: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.35) 75%, transparent 100%);
  pointer-events: none;
}

.header-row {
  display: flex;
  align-items: center;
  padding: 4px 12px;
  gap: 8px;
  pointer-events: auto;
}

.header-row-2 {
  padding: 2px 12px 4px 12px;
}

.btn-icon-header {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: transform 0.15s ease, background 0.15s ease;
}

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

.btn-saved-filter.active {
  background: rgba(236, 72, 153, 0.45);
  border-color: #EC4899;
}

.saved-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #EC4899;
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.filter-scroll-container {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 2px 0;
  flex: 1;
}

.filter-scroll-container::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  white-space: nowrap;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.filter-pill.active {
  background: #FFFFFF;
  color: #000000;
  border-color: #FFFFFF;
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
  transform: scale(1.02);
}

.filter-pill-age {
  font-size: 12px;
  padding: 4px 10px;
}

/* ==========================================================================
   Full Screen Video Feed (Butter-Smooth Flex Scroll Snap)
   ========================================================================== */

.feed-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  background-color: #000000;
  scrollbar-width: none;
}

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

/* Individual Slide (Strict 100% of container height - eliminates all snapping jitter) */
.video-slide {
  position: relative;
  width: 100%;
  height: 100%;
  flex: 0 0 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  background-color: #000000;
}

.video-poster,
.video-player {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.video-poster {
  z-index: 1;
}

.video-player {
  z-index: 2;
}

/* Bottom Overlay */
.slide-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 5;
  background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.55) 60%, transparent 100%);
  padding: 24px 16px calc(16px + var(--safe-bottom)) 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
}

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

/* TikTok Side Actions (Right) */
.slide-actions {
  position: absolute;
  right: 14px;
  bottom: calc(86px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  z-index: 10;
  pointer-events: auto;
}

.action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.btn-action-circle {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, background 0.15s ease;
}

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

.btn-save.saved {
  background: rgba(236, 72, 153, 0.45);
  border-color: #EC4899;
  animation: heartPop 0.35s ease;
}

@keyframes heartPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.save-count {
  font-size: 11px;
  font-weight: 700;
  color: #FFFFFF;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

/* Slide Info (Bottom Left) */
.slide-meta-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.meta-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(6px);
  color: #fff;
}

.meta-tag-pages {
  background: rgba(79, 70, 229, 0.55);
}

.slide-title {
  font-size: 18px;
  font-weight: 800;
  color: #FFFFFF;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
  line-height: 1.3;
  margin-bottom: 4px;
  max-width: 82%;
}

.slide-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 12px;
  max-width: 80%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

/* TikTok Shop Product Row */
.slide-product-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  padding: 8px 10px 8px 14px;
}

.slide-price-box {
  display: flex;
  flex-direction: column;
}

.slide-price {
  font-size: 20px;
  font-weight: 900;
  color: #FFFFFF;
  letter-spacing: -0.2px;
}

.slide-price-free {
  color: #34D399;
  font-size: 16px;
  text-transform: uppercase;
}

.slide-old-price {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: line-through;
  margin-top: -2px;
}

.btn-buy {
  padding: 12px 18px;
  border-radius: 14px;
  border: none;
  font-size: 14px;
  font-weight: 800;
  color: #FFFFFF;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}

.btn-buy:active {
  transform: scale(0.96);
}

.btn-buy-paid {
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
}

.btn-buy-free {
  background: linear-gradient(135deg, #059669 0%, #10B981 100%);
}

/* ==========================================================================
   Empty Feed State & Toasts
   ========================================================================== */

.empty-feed {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 30px;
  text-align: center;
}

.empty-icon {
  font-size: 56px;
  margin-bottom: 12px;
}

.empty-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}

.empty-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.btn-reset-filters {
  background: #fff;
  color: #0F172A;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.toast-notification {
  position: absolute;
  top: calc(var(--safe-top) + 110px);
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  border: 1px solid var(--glass-border);
  white-space: nowrap;
}

.toast-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   Legal & Meta Compliance Modal
   ========================================================================== */

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.legal-modal {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 90%;
  max-width: 380px;
  background: #FFFFFF;
  color: #1E293B;
  z-index: 250;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  box-shadow: 10px 0 30px rgba(0,0,0,0.25);
}

.legal-modal.active {
  transform: translateX(0);
}

.legal-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #E2E8F0;
}

.legal-title {
  font-size: 18px;
  font-weight: 800;
  color: #0F172A;
}

.btn-close-modal {
  background: #F1F5F9;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  font-size: 16px;
  cursor: pointer;
}

.legal-nav {
  display: flex;
  overflow-x: auto;
  padding: 8px 16px;
  gap: 6px;
  border-bottom: 1px solid #E2E8F0;
  scrollbar-width: none;
}

.legal-nav-btn {
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid #E2E8F0;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: #64748B;
  cursor: pointer;
}

.legal-nav-btn.active {
  background: #4F46E5;
  color: #fff;
  border-color: #4F46E5;
}

.legal-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  font-size: 13px;
  line-height: 1.6;
  color: #334155;
}

.legal-tab-content {
  display: none;
}

.legal-tab-content.active {
  display: block;
}

.legal-tab-content h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
  color: #0F172A;
}

.legal-tab-content p {
  margin-bottom: 12px;
}
