/* TeleVideo / Viral Link Unlimited - Telegram Mini App Stylesheet
 * Premium Dark Theme: #0B1020 (Bg), #111A2E (Cards), #202C43 (Surface), #24B8F0 (Cyan), #F5B82E (Gold)
 */
:root {
  --bg-primary: #0B1020;
  --bg-card: #111A2E;
  --bg-surface: #202C43;
  --bg-surface-hover: #293754;
  --accent-cyan: #24B8F0;
  --accent-cyan-hover: #1ca3d6;
  --accent-gold: #F5B82E;
  --accent-emerald: #10B981;
  --accent-red: #EF4444;
  --text-primary: #F5F7FF;
  --text-secondary: #9BAAC2;
  --text-muted: #64748B;
  --border-subtle: #1E2B45;
  --border-card: #1A263D;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --bottom-bar-height: 60px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.45;
  min-height: 100vh;
  padding-bottom: calc(var(--bottom-bar-height) + env(safe-area-inset-bottom, 12px) + 20px);
  user-select: none;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Telegram Safe Area Handling */
.safe-top {
  padding-top: env(safe-area-inset-top, 0px);
}
.safe-bottom {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Header */
.glass-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 16, 32, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

/* Bottom Navigation Bar - Optimized for 6 items on 320px–430px */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-bar-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(17, 26, 46, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 50;
  padding-left: 2px;
  padding-right: 2px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  padding: 4px 1px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  transition: all 0.18s ease;
  position: relative;
  cursor: pointer;
}

.nav-item svg {
  width: 19px;
  height: 19px;
  margin-bottom: 2px;
  transition: transform 0.18s ease, stroke 0.18s ease, color 0.18s ease;
  stroke: var(--text-secondary);
}

.nav-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.1;
}

.nav-item.active {
  color: var(--accent-cyan);
  font-weight: 600;
}

.nav-item.active svg {
  transform: translateY(-1.5px);
  stroke: var(--accent-cyan);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  top: 0;
  width: 24px;
  height: 2.5px;
  background: var(--accent-cyan);
  border-radius: 0 0 3px 3px;
  box-shadow: 0 1px 6px rgba(36, 184, 240, 0.4);
}

/* Video Cards & Grid */
.video-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
}

.video-card:active {
  transform: scale(0.985);
}

.video-card:hover {
  border-color: rgba(36, 184, 240, 0.35);
}

.thumbnail-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #080c18;
  overflow: hidden;
}

.thumbnail-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.video-card:hover .thumbnail-wrap img {
  transform: scale(1.03);
}

.badge-overlay {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(11, 16, 32, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.badge-unlocked {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(16, 185, 129, 0.92);
  color: #FFFFFF;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 3px;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

.badge-price {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(11, 16, 32, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-gold);
  border: 1px solid rgba(245, 184, 46, 0.35);
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Category Chips */
.chip {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid var(--border-subtle);
  transition: all 0.15s ease;
  cursor: pointer;
  flex-shrink: 0;
}

.chip.active {
  background: var(--accent-cyan);
  color: #0B1020;
  font-weight: 700;
  border-color: var(--accent-cyan);
  box-shadow: 0 2px 8px rgba(36, 184, 240, 0.25);
}

/* Buttons */
.btn-primary {
  background: var(--accent-cyan);
  color: #0B1020;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 13px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 0.18s ease, transform 0.1s ease;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-cyan {
  background: var(--accent-cyan);
  color: #0B1020;
}
.btn-cyan:hover:not(:disabled) {
  background: var(--accent-cyan-hover);
}

.btn-gold {
  background: var(--accent-gold);
  color: #0B1020;
}
.btn-gold:hover:not(:disabled) {
  background: #e5a722;
}

.btn-emerald {
  background: var(--accent-emerald);
  color: #FFFFFF;
}
.btn-emerald:hover:not(:disabled) {
  background: #0d9668;
}

.btn-surface {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}
.btn-surface:hover:not(:disabled) {
  background: var(--bg-surface-hover);
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, #111A2E 25%, #202C43 50%, #111A2E 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.5s infinite;
  border-radius: var(--radius-xs);
}

@keyframes skeleton-wave {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Modals & Bottom Sheets */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 16, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

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

.modal-sheet {
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal-sheet {
  transform: translateY(0);
}

/* Filter Option Buttons */
.filter-opt-btn {
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  transition: all 0.15s ease;
  cursor: pointer;
}

.filter-opt-btn.active {
  background: rgba(36, 184, 240, 0.16);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  font-weight: 700;
}

/* Toast */
.toast-box {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(-24px);
  background: var(--bg-surface);
  border: 1px solid var(--accent-cyan);
  color: var(--text-primary);
  padding: 9px 18px;
  border-radius: var(--radius-full);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  font-size: 12px;
  font-weight: 600;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 90%;
  text-align: center;
}

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

.toast-box.error {
  border-color: var(--accent-red);
}

.toast-box.success {
  border-color: var(--accent-emerald);
}

/* Ad Progress Stepper & Recovery Bar */
.ad-stepper {
  display: flex;
  gap: 6px;
  width: 100%;
}

.ad-stepper-step {
  flex: 1;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  transition: background-color 0.3s ease;
}

.ad-stepper-step.completed {
  background: var(--accent-emerald);
}

.ad-stepper-step.current {
  background: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(36, 184, 240, 0.6);
}

/* Custom Scrollbar for chips */
.scrollbar-none::-webkit-scrollbar {
  display: none;
}
.scrollbar-none {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
