:root {
  --bg-deep: #07080c;
  --bg-surface: #0e111a;
  --bg-card: #121622;
  --bg-card-hover: #171d2c;
  --bg-header: rgba(7, 8, 12, 0.88);
  --bg-nav: rgba(10, 13, 20, 0.92);
  
  --brand-blue: #38bdf8;
  --brand-cyan: #06b6d4;
  --brand-indigo: #6366f1;
  --brand-red: #f43f5e;
  
  --btn-primary: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
  --btn-primary-hover: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  --btn-next: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  
  --text-white: #f8fafc;
  --text-dim: #94a3b8;
  --text-muted: #64748b;
  
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(56, 189, 248, 0.35);
  
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-pill: 9999px;
  
  --font-brand: 'Outfit', sans-serif;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  background-color: var(--bg-deep);
  color: var(--text-white);
  font-family: var(--font-main);
  line-height: 1.5;
  overflow-x: hidden;
  user-select: none;
  min-height: 100vh;
  padding-bottom: 90px;
}

/* App Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
  padding: 12px 16px 10px;
}

.brand-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo-img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}

.brand-text {
  font-family: var(--font-brand);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #ffffff;
}

.brand-text span {
  color: var(--brand-blue);
  margin-left: 2px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-glass);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
}

.status-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

/* Segmented Platform Bar */
.platform-bar {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.platform-bar::-webkit-scrollbar {
  display: none;
}

.seg-btn {
  flex: 1;
  min-width: fit-content;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-xs);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.seg-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Content Container & Sections */
.content-container {
  padding: 16px;
  max-width: 860px;
  margin: 0 auto;
}

.view-section {
  display: none;
  animation: viewFade 0.22s ease-out forwards;
}

.view-section.active {
  display: block;
}

@keyframes viewFade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 16px;
}

.section-title {
  font-family: var(--font-brand);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: 2px;
}

.metric-pill {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--brand-blue);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

/* Video Grid - Single column in Mini App / Mobile, responsive multi-column on desktop */
.video-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .video-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

@media (min-width: 1024px) {
  .video-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
}

/* Cinema Video Card */
.cinema-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.22s ease;
}

.cinema-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #090c14;
  overflow: hidden;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.cinema-card:hover .card-media img {
  transform: scale(1.04);
}

.card-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(7, 9, 14, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.card-tag.terabox { color: #38bdf8; }
.card-tag.diskwala { color: #34d399; }
.card-tag.flezen { color: #a78bfa; }

.card-content {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
  gap: 12px;
}

.card-heading {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-white);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-card-stream {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--btn-primary);
  color: #fff;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 9px 12px;
  border-radius: var(--radius-xs);
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-card-stream:hover {
  background: var(--btn-primary-hover);
}

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

.btn-card-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xs);
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-card-copy:hover {
  color: var(--text-white);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-card-copy:active {
  transform: scale(0.95);
}

.btn-card-bookmark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.btn-card-bookmark:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

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

.btn-card-bookmark.saved {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.4);
  color: #f43f5e;
}

.btn-card-bookmark.saved svg {
  fill: currentColor;
}

/* Load More Button */
.load-more-container {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

.btn-load-more {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-white);
  padding: 10px 24px;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-load-more:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-load-more:active {
  transform: scale(0.97);
}

/* 2. REEL CARD CINEMA */
.reel-view-wrapper {
  max-width: 520px;
  margin: 0 auto;
}

.reel-card-cinema {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

.reel-media-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #090c14;
}

.reel-media-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reel-gradient-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.1) 40%, rgba(7, 8, 12, 0.85) 100%);
}

.reel-badge-top {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--brand-blue);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
}

.reel-details {
  padding: 16px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.reel-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-white);
  min-height: 48px;
}

.reel-button-row {
  display: flex;
  gap: 10px;
}

.btn-cinema-play {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--btn-primary);
  color: #fff;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.25);
}

.btn-cinema-play:active {
  transform: scale(0.97);
}

.btn-cinema-action {
  width: 48px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-white);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

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

.btn-cinema-save {
  width: 48px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-white);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.btn-cinema-save.saved {
  background: rgba(244, 63, 94, 0.18);
  border-color: rgba(244, 63, 94, 0.5);
  color: #f43f5e;
}

.btn-cinema-save.saved svg {
  fill: currentColor;
}

.btn-next-cinema {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--btn-next);
  color: #fff;
  border: none;
  font-size: 1.02rem;
  font-weight: 700;
  padding: 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.3);
  transition: all 0.2s ease;
}

.btn-next-cinema:hover {
  filter: brightness(1.1);
}

.btn-next-cinema:active {
  transform: scale(0.97);
}

/* 4. SEARCH VIEW */
.search-wrap {
  margin-bottom: 12px;
}

.search-input-field {
  position: relative;
  display: flex;
  align-items: center;
}

.search-ico {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input-field input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-pill);
  padding: 13px 44px 13px 44px;
  color: var(--text-white);
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}

.search-input-field input:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.2);
}

.btn-search-clear {
  position: absolute;
  right: 14px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-dim);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
}

.search-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  text-align: center;
}

/* 5. WATCHLIST VIEW */
.btn-danger-pill {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-danger-pill:hover {
  background: rgba(239, 68, 68, 0.2);
}

.watchlist-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.watchlist-row {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.watchlist-row-info {
  flex: 1;
  overflow: hidden;
}

.watchlist-row-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.watchlist-row-url {
  font-size: 0.72rem;
  color: var(--brand-blue);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.watchlist-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-row-copy {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-dim);
  font-size: 0.8rem;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-row-copy:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.btn-row-play {
  background: var(--btn-primary);
  color: #fff;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
}

.btn-row-del {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: #f87171;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
}

/* Empty State */
.empty-cinema {
  text-align: center;
  padding: 48px 20px;
}

.empty-ico-box {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--text-muted);
}

.empty-cinema h3 {
  font-family: var(--font-brand);
  font-size: 1.15rem;
  margin-bottom: 6px;
}

.empty-cinema p {
  color: var(--text-muted);
  font-size: 0.85rem;
  max-width: 320px;
  margin: 0 auto 20px;
}

.btn-cinema-accent {
  background: var(--btn-primary);
  color: #fff;
  border: none;
  padding: 10px 22px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  cursor: pointer;
}

/* Bottom Floating Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-nav);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border-glass);
  display: flex;
  justify-content: space-around;
  padding: 8px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}

.nav-item {
  position: relative;
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 12px;
  border-radius: var(--radius-xs);
  transition: all 0.2s ease;
}

.nav-svg {
  transition: transform 0.2s ease, stroke 0.2s ease;
}

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

.nav-item.active .nav-svg {
  stroke: var(--brand-blue);
  transform: translateY(-2px);
}

.nav-icon-wrap {
  position: relative;
}

.nav-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  background: var(--brand-red);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: var(--radius-pill);
  min-width: 16px;
  text-align: center;
}

/* Toast Notification */
.toast-popup {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: rgba(18, 22, 34, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-focus);
  color: #fff;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: slideToast 0.22s ease-out forwards;
}

@keyframes slideToast {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.toast-icon {
  color: #10b981;
  font-weight: 800;
}

/* Spinner & Utility */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.hidden {
  display: none !important;
}

/* Pull To Refresh Indicator */
.ptr-indicator {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translate(-50%, -60px);
  z-index: 999;
  background: rgba(18, 22, 34, 0.92);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-white);
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s cubic-bezier(0.1, 0.9, 0.2, 1), opacity 0.2s ease;
}

.ptr-indicator.pulling,
.ptr-indicator.refreshing {
  opacity: 1;
}

.ptr-spinner-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-cyan);
  transition: transform 0.15s ease;
}

.ptr-indicator.refreshing .ptr-spinner-icon {
  animation: spin 0.7s linear infinite;
}

.ptr-text {
  letter-spacing: 0.2px;
}
