*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --green: #00ff41;
  --red: #ff2e2e;
  --blue: #00b4ff;
  --grey-light: #cccccc;
  --grey-medium: #888888;
  --grey-dark: #555555;
  --white: #e0e0e0;
  --bg: #1a1a1a;
  --panel: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.18);
}

html {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar {
  display: none;
}

html, body {
  width: 100%; height: 100%;
  background: var(--bg);
  font-family: 'Fira Code', monospace !important;
  color: var(--white);
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  line-height: 1.6;
  overflow-y: scroll;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

* {
  font-family: 'Fira Code', monospace !important;
}

/* ── MATRIX CANVAS ── */
#matrix {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  opacity: 0.13;
}

/* ── SCANLINES ── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0,0,0,0.18) 3px,
    rgba(0,0,0,0.18) 4px
  );
  pointer-events: none;
  z-index: 999;
}

body.home-page::after {
  content: none;
}

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

/* ── CORNERS ── */
.corner {
  position: fixed;
  width: 80px; height: 80px;
  border-color: var(--grey-dark);
  border-style: solid;
  opacity: 0.35;
  z-index: 5;
}
.corner--tl { top: 24px; left: 24px; border-width: 2px 0 0 2px; }
.corner--tr { top: 24px; right: 24px; border-width: 2px 2px 0 0; }
.corner--bl { bottom: 24px; left: 24px; border-width: 0 0 2px 2px; }
.corner--br { bottom: 24px; right: 24px; border-width: 0 2px 2px 0; }

/* ── PAGE LAYOUT ── */
.wrapper {
  position: relative;
  z-index: 1200;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
}

.landing-stack {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

/* ── LOGO ── */
.logo {
  width: 100%;
  max-width: 600px;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  animation: fadeUp 0.8s ease both;
  text-align: center;
}
.critical, .thinking {
  display: block;
  font-size: clamp(48px, 10vw, 78px);
  font-weight: 500;
  line-height: 1;
  position: relative;
}
.crit {
  color: var(--red);
  text-shadow: 0 0 5px var(--red), 0 0 40px rgba(255,46,46,0.4);
}
.ical {
  color: var(--white);
}
.thinking {
  color: var(--blue);
  text-shadow: 0 0 5px var(--blue), 0 0 40px rgba(0,180,255,0.4);
  margin-top: 0;
}
.badge-wrapper {
  text-align: center;
}
.brackets {
  color: #aaaaaa;
  text-shadow: none;
}

.badge {
  display: inline-block;
  margin-top: 0;
  padding: 5px 18px;
  border: 1px solid var(--green);
  border-radius: 2px;
  font-size: clamp(9px, 2vw, 11px);
  letter-spacing: 0.28em;
  color: var(--green);
  background: rgba(0,255,65,0.06);
  box-shadow: 0 0 14px rgba(0,255,65,0.15), inset 0 0 14px rgba(0,255,65,0.04);
  animation: fadeUp 0.8s 0.15s ease both;
}

/* ── DIVIDER ── */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 480px;
  margin: 0;
  animation: fadeUp 0.8s 0.25s ease both;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--grey-dark), transparent);
}
.divider span {
  font-size: 10px;
  letter-spacing: 0.25em;
  color: var(--grey-medium);
  opacity: 0.7;
}

.login-card {
  width: 100%;
  max-width: 480px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 36px 36px 0;
  position: relative;
  animation: fadeUp 0.8s 0.35s ease both;
  backdrop-filter: blur(4px);
  overflow: hidden;
}

/* small diamond accent top-right */
.login-card::before {
  content: 'beta';
  position: absolute;
  top: 10px; right: 14px;
  font-size: 8px;
  color: var(--red);
  opacity: 0.4;
}

/* ── card-header ── */
.card-header {
  margin-bottom: 0;
}

.card-header h1 {
  display: none;
}

/* ── discord button ── */
.discord-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 16px 24px;
  background: rgba(88, 101, 242, 0.12);
  border: 1px solid rgba(88, 101, 242, 0.5);
  border-radius: 4px;
  color: #7289da;
  font-size: 15px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}
.discord-login-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(114,137,218,0.15) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}
.discord-login-btn:hover::before { transform: translateX(100%); }
.discord-login-btn:hover {
  border-color: rgba(88, 101, 242, 0.9);
  color: #fff;
  box-shadow: 0 0 10px rgba(88,101,242,0.3), 0 0 40px rgba(88,101,242,0.1);
  transform: translateY(-1px);
}
.discord-icon {
  width: 22px; height: 22px;
  fill: currentColor;
  flex-shrink: 0;
}

/* ── footer ── */
.footer {
  margin-top: 22px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  text-align: center;
}
.footer p {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: rgba(136, 136, 136, 0.35);
}
.footer p::before { content: '$ '; color: var(--grey-medium); opacity: 0.5; }
.footer p::after  {
  content: '';
  display: inline-block;
  width: 7px; height: 12px;
  background: var(--grey-medium);
  vertical-align: middle;
  margin-left: 3px;
  animation: blink 1s step-end infinite;
}

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.2} }

/* ── HOME PAGE STYLES ── */
.navbar {
  background: #232324;
  border-bottom: 1px solid #404040;
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
}

.navbar .logo {
  height: 40px;
  width: auto;
}

.user-section {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #333333;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #58a6ff;
  font-weight: 600;
  font-size: 0.9rem;
}

.username {
  color: #ffffff;
  font-weight: 500;
}

.logout-btn {
  padding: 0.5rem 1.25rem;
  background: #333333;
  color: #58a6ff;
  border: 1px solid #404040;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.logout-btn:hover {
  background: #404040;
  border-color: #58a6ff;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  position: relative;
  z-index: 10;
}

.header-section {
  margin-bottom: 1.5rem;
  padding-bottom: 0;
}

.header-section h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.5rem;
}

.header-section p {
  color: #cccccc;
  font-size: 1.1rem;
}

.error-message {
  background: #2a2a2a;
  color: #ff6b6b;
  padding: 1rem;
  border-radius: 8px;
  border-left: 3px solid #ff6b6b;
  margin-bottom: 2rem;
  display: none;
}

.loading {
  text-align: center;
  color: #cccccc;
  font-size: 1.1rem;
  padding: 4rem;
}

.videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  padding-top: 0.5rem;
}

.folder {
  position: relative;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.folder-tab {
  position: absolute;
  top: -8px;
  left: 16px;
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  z-index: 2;
  transition: all 0.3s ease;
}

.folder-tab::before {
  content: '▶';
  font-size: 8px;
}

.folder-tab.youtube { background: #ff0000; }
.folder-tab.google_drive { background: #4285f4; }
.folder-tab.dropbox { background: #0061ff; }
.folder-tab.onedrive { background: #0078d4; }
.folder-tab.discord { background: #9241b8; }
.folder-tab.other { background: #666666; }

.folder:hover .folder-tab {
  top: -12px;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.15);
}

.folder-tab.youtube:hover, .folder:hover .folder-tab.youtube { box-shadow: 0 4px 12px rgba(255, 0, 0, 0.3); }
.folder-tab.google_drive:hover, .folder:hover .folder-tab.google_drive { box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3); }
.folder-tab.dropbox:hover, .folder:hover .folder-tab.dropbox { box-shadow: 0 4px 12px rgba(0, 97, 255, 0.3); }
.folder-tab.onedrive:hover, .folder:hover .folder-tab.onedrive { box-shadow: 0 4px 12px rgba(0, 120, 212, 0.3); }
.folder-tab.discord:hover, .folder:hover .folder-tab.discord { box-shadow: 0 4px 12px rgba(146, 65, 184, 0.3); }
.folder-tab.other:hover, .folder:hover .folder-tab.other { box-shadow: 0 4px 12px rgba(102, 102, 102, 0.3); }

.video-card {
  background: rgba(42, 42, 42, 0.4);
  border-radius: 8px;
  padding: 28px 20px 20px 20px;
  width: 100%;
  border: 1px solid #2a2a2a;
  outline: 1px solid #353535;
  transition: all 0.3s ease;
  position: relative;
  min-height: 240px;
  height: auto;
  display: flex;
  flex-direction: column;
}

.folder:hover .video-card {
  transform: translateY(-4px);
  border-color: #3a3a3a;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.video-title {
  font-size: 18px;
  font-weight: 500;
  color: #5eb3e4;
  margin-bottom: 10px;
  letter-spacing: 0.3px;
  line-height: 1.3;
  transition: color 0.3s ease;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder:hover .video-title {
  color: #7ec8f0;
}

.video-meta {
  display: flex;
  gap: 1rem;
  margin-bottom: 12px;
  color: #888;
  font-size: 12px;
}

.video-meta span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.video-description {
  color: #999;
  font-size: 13px;
  line-height: 1.5;
  margin-top: 8px;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 6rem 2rem;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.empty-state h2 {
  color: #ffffff;
  margin-bottom: 1rem;
  font-size: 2rem;
}

.empty-state p {
  color: #cccccc;
  font-size: 1.1rem;
}

.tag-filter-btn {
  padding: 8px 16px;
  background: transparent;
  color: #a0a0a0;
  border: 1px solid #404040;
  border-radius: 6px;
  font-family: 'Fira Code', monospace;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.tag-filter-btn:hover {
  border-color: #505050;
  color: #c0c0c0;
}

.tag-filter-btn.active {
  background: #58a6ff;
  color: #ffffff;
  border-color: #58a6ff;
}

.tag-filter-btn.active:hover {
  background: #79c0ff;
  border-color: #79c0ff;
}

.video-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
  margin-bottom: 0;
}

.video-tag {
  display: inline-block;
  background: #2a2a2a;
  color: #5eb3e4;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  transition: all 0.3s ease;
}

.folder:hover .video-tag {
  background: #3a3a3a;
  color: #7ec8f0;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 3rem;
  padding: 2rem 0;
}

.pagination-btn {
  padding: 8px 12px;
  background: transparent;
  color: #888;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  min-width: 36px;
  text-align: center;
}

.pagination-btn:hover:not(:disabled) {
  background: #2a2a2a;
  color: #58a6ff;
}

.pagination-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pagination-btn.active {
  background: #58a6ff;
  color: #ffffff;
}

.pagination-info {
  color: #888;
  font-size: 13px;
  padding: 0 12px;
  font-weight: 400;
}

.page-nav-side {
  display: none !important;
}

.page-nav-side:hover:not(:disabled) {
  color: rgba(88, 166, 255, 0.9);
}

.page-nav-side:disabled {
  opacity: 0;
  cursor: not-allowed;
  pointer-events: none;
}

.search-wrapper {
  background: rgba(32, 32, 32, 0.6);
  border: 1px solid #404040;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.search-input {
  flex: 1;
  padding: 12px 16px;
  background: #2828289f;
  border: 1px solid #404040;
  border-radius: 8px;
  color: #ffffff;
  font-size: 14px;
  font-family: 'Fira Code', monospace;
  outline: none;
  transition: border-color 0.2s;
}

.search-input::placeholder {
  color: #888888;
}

.search-input:focus {
  border-color: #58a6ff;
}

.search-btn {
  padding: 12px 28px;
  background: #343434a8;
  color: #58a6ff;
  border: 1px solid #404040;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Fira Code', monospace;
  font-weight: 500;
  font-size: 14px;
  transition: background-color 0.2s;
  white-space: nowrap;
}

.search-btn:hover {
  background: #404040;
  border: 1px solid #404040;
  border-color: #58a6ff;
}

.clear-search {
  padding: 12px 20px;
  background: #333333;
  color: #cccccc;
  border: 1px solid #404040;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.clear-search:hover {
  background: #404040;
  border-color: #ff6b6b;
  color: #ff6b6b;
}

.filters-section {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .pagination {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .pagination-btn {
    min-width: 40px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }
  
  .pagination-info {
    width: 100%;
    text-align: center;
    padding: 0.5rem 0;
  }
  
  .search-wrapper {
    margin-bottom: 1.5rem;
  }
  
  .search-bar {
    flex-direction: column;
    margin-bottom: 16px;
  }
  
  .search-btn, .clear-search {
    width: 100%;
  }
  
  .page-nav-side {
    display: none;
  }
}

@media (max-width: 768px) {
  .navbar {
    padding: 1rem;
  }

  .navbar .logo {
    height: 30px;
  }

  .container {
    padding: 1rem;
  }

  .header-section h1 {
    font-size: 1.75rem;
  }

  .videos-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
  }

  .user-section {
    gap: 0.75rem;
  }

  .username {
    display: none;
  }
}
