/* ═══════════════════════════════════════════════════
   IMPACT REALITY — Global Stylesheet
   Dark cinema aesthetic · Red razor accent
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300&family=Syne:wght@400;600;700;800&display=swap');

/* ─── Custom Properties ─────────────────────── */
:root {
  --bg-void:      #060607;
  --bg-base:      #0d0d0f;
  --bg-surface:   #131316;
  --bg-elevated:  #1a1a1f;
  --bg-hover:     #212128;

  --red:          #e3000f;
  --red-dim:      #8b000a;
  --red-glow:     rgba(227, 0, 15, 0.18);
  --red-subtle:   rgba(227, 0, 15, 0.08);

  --text-primary:  #f0f0f2;
  --text-secondary:#9494a0;
  --text-muted:    #555560;
  --text-red:      #e3000f;

  --border:       rgba(255,255,255,0.06);
  --border-red:   rgba(227,0,15,0.4);

  --font-display: 'Bebas Neue', sans-serif;
  --font-ui:      'Syne', sans-serif;
  --font-mono:    'DM Mono', monospace;

  --radius-sm:    4px;
  --radius-md:    8px;
  --radius-lg:    14px;

  --shadow-red:   0 0 30px rgba(227,0,15,0.25), 0 0 60px rgba(227,0,15,0.1);
  --transition:   0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

  --scrollbar-w:  6px;
}

/* ─── Reset & Base ──────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Grain texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.6;
}

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

/* Scrollbar */
::-webkit-scrollbar { width: var(--scrollbar-w); height: var(--scrollbar-w); }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--red-dim); }

/* ─── Typography ────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.mono { font-family: var(--font-mono); }

/* ─── Navigation ────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: 62px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 0;
  background: linear-gradient(180deg, rgba(6,6,7,0.98) 0%, rgba(6,6,7,0.85) 100%);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.nav-logo-mark {
  width: 32px;
  height: 32px;
  background: var(--red);
  clip-path: polygon(0 0, 75% 0, 100% 50%, 75% 100%, 0 100%, 25% 50%);
  flex-shrink: 0;
  transition: transform var(--transition);
}

.nav-logo:hover .nav-logo-mark {
  transform: scale(1.1);
  filter: drop-shadow(0 0 8px var(--red));
}

.nav-logo-text {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.12em;
  color: var(--text-primary);
  white-space: nowrap;
}

.nav-logo-text span {
  color: var(--red);
}

.nav-categories {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 36px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nav-categories::-webkit-scrollbar { display: none; }

.nav-cat {
  padding: 6px 14px;
  border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  transition: all var(--transition);
  border: 1px solid transparent;
  cursor: pointer;
}

.nav-cat:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
  border-color: var(--border);
}

.nav-cat.active {
  color: var(--red);
  background: var(--red-subtle);
  border-color: var(--border-red);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 20px;
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary {
  background: var(--red);
  color: #fff;
  border: 1px solid var(--red);
}

.btn-primary:hover {
  background: #ff0010;
  box-shadow: var(--shadow-red);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.15);
  background: var(--bg-elevated);
}

/* ─── Layout Wrapper ────────────────────────── */
.page-wrap {
  padding-top: 62px;
  min-height: 100vh;
}

/* ─── Hero / Sort Bar ───────────────────────── */
.sort-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
  background: var(--bg-base);
  position: sticky;
  top: 62px;
  z-index: 100;
}

.sort-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sort-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.sort-btn {
  padding: 5px 12px;
  border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border: 1px solid transparent;
  background: transparent;
  transition: all var(--transition);
  cursor: pointer;
}

.sort-btn:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.sort-btn.active {
  color: var(--red);
  background: var(--red-subtle);
  border-color: var(--border-red);
}

.sort-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.view-btn {
  padding: 6px 10px;
  background: transparent;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
}

.view-btn:hover { background: var(--bg-elevated); color: var(--text-primary); }
.view-btn.active { background: var(--bg-elevated); color: var(--red); }

/* ─── Video Grid ────────────────────────────── */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  padding: 28px;
}

.video-grid.list-mode {
  grid-template-columns: 1fr;
  max-width: 900px;
  margin: 0 auto;
}

/* ─── Video Card ────────────────────────────── */
.video-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all var(--transition-slow);
  cursor: pointer;
  position: relative;
}

.video-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--red-glow) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition-slow);
  pointer-events: none;
  z-index: 0;
}

.video-card:hover {
  border-color: var(--border-red);
  transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), var(--shadow-red);
}

.video-card:hover::before { opacity: 1; }

.video-card.list-mode {
  display: grid;
  grid-template-columns: 280px 1fr;
  border-radius: var(--radius-md);
}

/* Thumbnail */
.card-thumb {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--bg-elevated);
  flex-shrink: 0;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.video-card:hover .card-thumb img {
  transform: scale(1.05);
}

.card-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.82);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 3px;
  letter-spacing: 0.04em;
}

.card-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0);
  transition: background var(--transition);
}

.video-card:hover .card-play-overlay {
  background: rgba(0,0,0,0.35);
}

.card-play-btn {
  width: 52px;
  height: 52px;
  background: var(--red);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.7);
  transition: all var(--transition);
  box-shadow: 0 0 30px rgba(227,0,15,0.6);
}

.video-card:hover .card-play-btn {
  opacity: 1;
  transform: scale(1);
}

.card-play-btn svg {
  margin-left: 3px;
}

/* Card Body */
.card-body {
  padding: 14px 16px 16px;
  position: relative;
  z-index: 1;
}

.card-cat {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 6px;
}

.card-title {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.card-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.card-meta-item svg {
  opacity: 0.5;
}

/* ─── Shorts Player ─────────────────────────── */
.shorts-mode-toggle {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.shorts-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--red);
  color: #fff;
  border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(227,0,15,0.5), 0 0 0 0 var(--red);
  animation: pulse-ring 2.5s ease-out infinite;
  transition: all var(--transition);
}

@keyframes pulse-ring {
  0%   { box-shadow: 0 4px 24px rgba(227,0,15,0.5), 0 0 0 0 rgba(227,0,15,0.4); }
  70%  { box-shadow: 0 4px 24px rgba(227,0,15,0.5), 0 0 0 14px rgba(227,0,15,0); }
  100% { box-shadow: 0 4px 24px rgba(227,0,15,0.5), 0 0 0 0 rgba(227,0,15,0); }
}

.shorts-btn:hover {
  background: #ff0010;
  transform: scale(1.04);
}

/* ─── Loading State ─────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-elevated) 0%,
    var(--bg-hover) 50%,
    var(--bg-elevated) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  border-radius: var(--radius-md);
}

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

.skeleton-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.skeleton-thumb {
  aspect-ratio: 16/9;
}

.skeleton-body {
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-line {
  height: 12px;
}

/* ─── Empty / Error State ───────────────────── */
.state-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 20px;
  gap: 16px;
  grid-column: 1 / -1;
}

.state-msg-icon {
  font-size: 48px;
  opacity: 0.3;
}

.state-msg-title {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
}

.state-msg-sub {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  max-width: 360px;
}

/* ─── Footer ────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 40px;
}

.footer-brand {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.footer-brand span { color: var(--red); }

.footer-copy {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* ─── Upload Page ───────────────────────────── */
.upload-wrap {
  max-width: 720px;
  margin: 48px auto;
  padding: 0 24px;
}

.upload-header {
  margin-bottom: 36px;
}

.upload-header h1 {
  font-size: 48px;
  color: var(--text-primary);
}

.upload-header h1 span { color: var(--red); }

.upload-header p {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

.form-block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 20px;
}

.form-block h3 {
  font-size: 20px;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  transition: border-color var(--transition);
  outline: none;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-subtle);
}

.field textarea { resize: vertical; min-height: 90px; }
.field select option { background: var(--bg-elevated); }

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--red);
  background: var(--red-subtle);
}

.dropzone input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.dropzone-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }
.dropzone-label {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}
.dropzone-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

.progress-bar-wrap {
  background: var(--bg-elevated);
  border-radius: 99px;
  height: 4px;
  margin-top: 14px;
  overflow: hidden;
  display: none;
}

.progress-bar-fill {
  height: 100%;
  background: var(--red);
  border-radius: 99px;
  transition: width 0.3s ease;
  width: 0%;
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 12px;
  margin-bottom: 16px;
  display: none;
}

.alert-success {
  background: rgba(0,200,80,0.1);
  border: 1px solid rgba(0,200,80,0.3);
  color: #00c850;
}

.alert-error {
  background: rgba(227,0,15,0.1);
  border: 1px solid var(--border-red);
  color: var(--red);
}

/* ─── Responsive ────────────────────────────── */
@media (max-width: 768px) {
  .nav-categories { display: none; }

  .video-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    padding: 16px;
    gap: 14px;
  }

  .sort-bar { padding: 14px 16px; }

  .video-card.list-mode {
    grid-template-columns: 1fr;
  }

  .footer {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .shorts-mode-toggle {
    bottom: 20px;
    right: 20px;
  }
}

@media (max-width: 480px) {
  .nav { padding: 0 16px; }
  .nav-logo-text { font-size: 18px; }
  .video-grid { grid-template-columns: 1fr; }
}

/* ─── Page load animation ───────────────────── */
.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

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

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }

/* ─── Red line accent ───────────────────────── */
.red-line {
  display: block;
  width: 40px;
  height: 3px;
  background: var(--red);
  border-radius: 99px;
  margin-bottom: 16px;
}

/* ─── Tooltip ───────────────────────────────── */
[data-tip] {
  position: relative;
}

[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  border: 1px solid var(--border);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

[data-tip]:hover::after { opacity: 1; }


/* Embed mode – ukrycie kontrolek */
.player-controls.embed-mode {
  opacity: 0;
  pointer-events: none;
}
.player-controls.embed-mode .progress-wrap,
.player-controls.embed-mode .volume-wrap,
.player-controls.embed-mode #playPauseBtn {
  display: none;
}
.embed-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
