/* ================================================================
   LokTube v205 — UI Patch CSS
   Fixes: upload form empty space, profile empty areas,
          home feed, general polish
   ================================================================ */

/* ── Upload Form: Remove large empty bottom gap ── */
.upload-form-wrap,
.upload-section:last-child,
.uf-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
}

/* Ensure Publish button is always visible */
.upload-submit-row,
.uf-submit-row,
[class*="publish-btn-row"],
.upload-actions {
  position: sticky;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 68px);
  background: var(--bg1);
  border-top: 1px solid var(--border);
  padding: 14px 16px;
  z-index: 50;
  margin: 0 -16px;
}

/* ── Video cards: fix broken thumbnail display ── */
.yt-card {
  cursor: pointer;
  border-radius: 14px;
  overflow: hidden;
  transition: transform .15s;
  background: var(--bg1);
}
.yt-card:hover { transform: translateY(-2px); }
.yt-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg3);
  border-radius: 12px;
  overflow: hidden;
}
.yt-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.yt-dur {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0,0,0,.85);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
}
.yt-info {
  display: flex;
  gap: 10px;
  padding: 10px 4px 4px;
}
.yt-avatar-wrap { flex-shrink: 0; }
.yt-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}
.yt-avatar-fallback {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
}
.yt-meta { flex: 1; min-width: 0; }
.yt-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 2px;
}
.yt-channel { font-size: 12px; color: var(--text3); margin-bottom: 2px; }
.yt-stats   { font-size: 12px; color: var(--text3); }

/* ── Grid Layout ── */
.yt-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  padding: 0 12px 16px;
}
@media (min-width: 600px) {
  .yt-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 900px) {
  .yt-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ── Hero card ── */
.hero-card {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  cursor: pointer;
  margin-bottom: 8px;
}
.hero-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.85) 0%, rgba(0,0,0,.1) 60%, transparent 100%);
}
.hero-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: .3px;
}
.hero-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  background: rgba(255,107,0,.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  box-shadow: 0 4px 20px rgba(255,107,0,.5);
}
.hero-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px;
}
.hero-title {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  line-height: 1.3;
  margin-bottom: 4px;
  text-shadow: 0 1px 4px rgba(0,0,0,.8);
}
.hero-meta {
  font-size: 13px;
  color: rgba(255,255,255,.75);
}

/* ── Cat bar ── */
.cat-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 12px;
  scrollbar-width: none;
  background: var(--bg1);
  border-bottom: 1px solid var(--border);
}
.cat-bar::-webkit-scrollbar { display: none; }
.cat-pill {
  flex: 0 0 auto;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: .2s;
}
.cat-pill:hover { border-color: var(--accent); color: var(--accent); }
.cat-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Stories row ── */
.stories-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 12px 14px;
  scrollbar-width: none;
  background: var(--bg1);
  border-bottom: 1px solid var(--border);
}
.stories-row::-webkit-scrollbar { display: none; }
.story-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  flex-shrink: 0;
}
.story-ring {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(135deg, #FF6B00, #FF9800, #FFD700);
}
.story-ring.story-add {
  background: var(--bg3);
  border: 2px dashed var(--border);
}
.story-ring-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg2);
  border: 2px solid var(--bg1);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.story-ring-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.story-add-icon {
  font-size: 22px;
  color: var(--accent);
  font-weight: 300;
}
.story-label {
  font-size: 11px;
  color: var(--text2);
  font-weight: 600;
  max-width: 64px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Profile page enhancements ── */
.profile-banner {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}
.profile-banner-placeholder {
  width: 100%;
  height: 160px;
  background: linear-gradient(135deg, #FF6B00 0%, #FF4500 40%, #1a1a1a 100%);
}
.profile-stats-bar {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  margin: 14px 0;
}
.profile-stat {
  flex: 1;
  text-align: center;
  padding: 14px 8px;
  border-right: 1px solid var(--border);
}
.profile-stat:last-child { border-right: none; }
.profile-stat-num {
  font-size: 20px;
  font-weight: 900;
  color: var(--accent);
  display: block;
  line-height: 1;
}
.profile-stat-label {
  font-size: 11px;
  color: var(--text3);
  margin-top: 4px;
  font-weight: 600;
}

/* ── Monetization Streak ── */
.streak-day.done { background: var(--accent) !important; border-color: var(--accent) !important; color: #fff !important; }
.streak-bar-fill { background: linear-gradient(90deg, #FF6B00, #FF9800) !important; }

/* ── LokTweets / LokFeed tab highlight fix ── */
.lt-tab-bar, .lf-tab-bar {
  background: var(--bg1) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ── Bottom Nav active glow fix ── */
.bottom-nav-item.active .bottom-nav-icon {
  color: var(--accent) !important;
  filter: drop-shadow(0 0 6px rgba(255,107,0,.5));
}
.bottom-nav-label.active { color: var(--accent) !important; }

/* ── OTP Modal ── */
.otp-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.otp-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px 24px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.otp-icon { font-size: 48px; margin-bottom: 12px; }
.otp-title { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.otp-sub   { font-size: 14px; color: var(--text3); margin-bottom: 20px; }
.otp-input {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 16px;
  color: var(--text);
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 14px 20px;
  text-align: center;
  width: 100%;
  outline: none;
  font-family: monospace;
}
.otp-input:focus { border-color: var(--accent); }
.otp-actions { display: flex; gap: 12px; margin-top: 20px; }
.otp-cancel {
  flex: 1; padding: 12px; border: 1px solid var(--border);
  background: none; color: var(--accent); border-radius: 50px;
  font-weight: 700; cursor: pointer;
}
.otp-verify {
  flex: 1; padding: 12px; background: var(--accent);
  color: #fff; border: none; border-radius: 50px;
  font-weight: 700; cursor: pointer;
}
.otp-success-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #2e7d32;
  color: #fff;
  padding: 10px 24px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 14px;
  z-index: 3000;
  animation: fadeUpToast .3s ease;
}
@keyframes fadeUpToast { from { opacity:0; transform:translateX(-50%) translateY(20px); } to { opacity:1; transform:translateX(-50%) translateY(0); } }

/* ── Empty state polish ── */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state h3 { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.empty-state p  { font-size: 14px; color: var(--text3); margin-bottom: 24px; }

/* ── Theme Engine Preview Card ── */
.theme-card {
  border: 2px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: .2s;
}
.theme-card:hover { border-color: var(--accent); transform: scale(1.02); }
.theme-card.active { border-color: var(--accent); box-shadow: 0 0 20px rgba(255,107,0,.3); }
.theme-card-preview { height: 80px; }
.theme-card-name { padding: 10px; font-size: 13px; font-weight: 700; color: var(--text); background: var(--bg2); }

/* ── PWA splash screen fix ──
   v221 FIX: this used to *replace* body's padding-top with just the
   safe-area inset, wiping out the space reserved for the fixed
   .navbar (position:fixed, height var(--nav-h)) — so in installed/
   standalone PWA mode content (incl. the top of the video player)
   scrolled up underneath the header. Now we ADD the notch inset on
   top of the existing nav-height offset instead of replacing it. */
@media (display-mode: standalone) {
  body { padding-top: calc(var(--nav-h) + 2.5px + env(safe-area-inset-top, 0px)); }
  body.has-catbar { padding-top: calc(var(--header-h) + env(safe-area-inset-top, 0px)); }
  .navbar { top: calc(2.5px + env(safe-area-inset-top, 0px)); }
  .bottom-nav { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); }
}

/* ── Smooth page transitions ── */
.page-enter { animation: pageEnter .25s ease; }
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

