/* ==================== SK GAMING TOP NAVIGATION ==================== */
/* Esports-grade navigation bar with industrial gaming aesthetic */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700&family=Barlow:wght@400;500;600&display=swap');

/* CSS Variables */
:root {
  --topnav-height: 52px;
  --topnav-bg: #111318;
  --topnav-bg-darker: #0a0b0e;
  --topnav-border: rgba(255, 255, 255, 0.06);
  --topnav-text: #8b919a;
  --topnav-text-hover: #e4e6eb;
  --topnav-text-active: #ffffff;
  --topnav-accent: #c9343a;
  --topnav-accent-hover: #e03d44;
  --topnav-dropdown-bg: #16181d;
  --topnav-dropdown-hover: rgba(255, 255, 255, 0.04);
  --topnav-dropdown-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Body adjustment for top nav */
body.has-topnav {
  padding-top: var(--topnav-height);
}

body.has-topnav .dashboard-container {
  height: calc(100vh - var(--topnav-height));
}

/* ==================== NAVIGATION CONTAINER ==================== */

.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topnav-height);
  background: var(--topnav-bg);
  border-bottom: 1px solid var(--topnav-border);
  z-index: 1000;
  font-family: 'Barlow', -apple-system, BlinkMacSystemFont, sans-serif;
}

.topnav-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 24px;
  max-width: 1920px;
  margin: 0 auto;
}

/* ==================== LOGO ==================== */

.topnav-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.topnav-logo-img {
  height: 32px;
  width: auto;
  filter: brightness(0.95);
  transition: filter 0.2s ease;
}

.topnav-logo:hover .topnav-logo-img {
  filter: brightness(1.1);
}

.topnav-logo-fallback {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #1a1d24 0%, #0d0f12 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: #ffffff;
  letter-spacing: -0.5px;
}

/* ==================== MAIN MENU ==================== */

.topnav-menu {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 48px;
  margin-right: auto;
}

.topnav-item {
  position: relative;
}

/* ==================== MENU BUTTONS ==================== */

.topnav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-radius: 4px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--topnav-text);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  white-space: nowrap;
}

.topnav-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.topnav-btn:hover {
  color: var(--topnav-text-hover);
}

.topnav-btn:hover::before {
  opacity: 1;
}

.topnav-btn.active {
  color: var(--topnav-text-active);
  background: rgba(255, 255, 255, 0.06);
}

.topnav-arrow {
  width: 8px;
  height: 5px;
  opacity: 0.6;
  transition: transform 0.2s ease, opacity 0.2s ease;
  flex-shrink: 0;
}

.topnav-item:hover .topnav-arrow {
  transform: rotate(180deg);
  opacity: 1;
}

/* ==================== DROPDOWN MENUS ==================== */

.topnav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 180px;
  background: var(--topnav-dropdown-bg);
  border: 1px solid var(--topnav-border);
  border-radius: 6px;
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--topnav-dropdown-shadow);
  z-index: 1001;
}

/* Invisible bridge to prevent gap issue */
.topnav-dropdown::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 0;
  right: 0;
  height: 12px;
}

.topnav-item:hover .topnav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.topnav-dropdown-item {
  display: block;
  padding: 10px 14px;
  color: var(--topnav-text);
  text-decoration: none;
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  font-weight: 500;
  border-radius: 4px;
  transition: all 0.12s ease;
  position: relative;
  cursor: pointer;
}

.topnav-dropdown-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 0;
  background: var(--topnav-accent);
  border-radius: 1px;
  transition: height 0.15s ease;
}

.topnav-dropdown-item:hover {
  color: var(--topnav-text-active);
  background: var(--topnav-dropdown-hover);
  padding-left: 18px;
}

.topnav-dropdown-item:hover::before {
  height: 16px;
}

.topnav-dropdown-item.active {
  color: var(--topnav-text-active);
  background: var(--topnav-dropdown-hover);
}

/* ==================== LOGOUT BUTTON ==================== */

.topnav-logout {
  padding: 7px 18px;
  background: transparent;
  border: 1px solid var(--topnav-accent);
  border-radius: 4px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--topnav-accent);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.topnav-logout:hover {
  background: var(--topnav-accent);
  color: #ffffff;
  box-shadow: 0 0 20px rgba(201, 52, 58, 0.25);
}

.topnav-logout:active {
  transform: scale(0.98);
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 1200px) {
  .topnav-menu {
    margin-left: 32px;
    gap: 2px;
  }

  .topnav-btn {
    padding: 8px 12px;
    font-size: 13px;
  }
}

@media (max-width: 900px) {
  .topnav-wrapper {
    padding: 0 16px;
  }

  .topnav-menu {
    margin-left: 24px;
  }

  .topnav-btn {
    padding: 8px 10px;
    font-size: 12px;
    letter-spacing: 0.5px;
  }

  .topnav-logout {
    padding: 6px 14px;
    font-size: 12px;
  }
}

/* ==================== HIDE OLD SIDEBAR ELEMENTS ==================== */

body.has-topnav .sidebar,
body.has-topnav .sidebar-toggle {
  display: none !important;
}

body.has-topnav .main-content {
  margin-left: 0;
  width: 100%;
}

/* ==================== ANIMATIONS ==================== */

@keyframes topnav-fade-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topnav {
  animation: topnav-fade-in 0.3s ease;
}

/* Staggered menu item appearance */
.topnav-item:nth-child(1) { animation: topnav-fade-in 0.3s ease 0.05s backwards; }
.topnav-item:nth-child(2) { animation: topnav-fade-in 0.3s ease 0.1s backwards; }
.topnav-item:nth-child(3) { animation: topnav-fade-in 0.3s ease 0.15s backwards; }
.topnav-item:nth-child(4) { animation: topnav-fade-in 0.3s ease 0.2s backwards; }
.topnav-item:nth-child(5) { animation: topnav-fade-in 0.3s ease 0.25s backwards; }

/* ==================== DIRECT PAGE BUTTON (no dropdown) ==================== */

.topnav-direct {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.topnav-direct:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
}

.topnav-direct.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.35);
}

/* ==================== GLOBAL SEARCH ==================== */

.topnav-search {
  position: relative;
  display: flex;
  align-items: center;
  margin-right: 12px;
}

.topnav-search-icon {
  position: absolute;
  left: 10px;
  width: 13px;
  height: 13px;
  color: #6b7280;
  pointer-events: none;
}

.topnav-search input {
  width: 230px;
  padding: 7px 12px 7px 30px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #fff;
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  outline: none;
  transition: all 0.15s ease;
}

.topnav-search input::placeholder { color: #5b6068; }

.topnav-search input:focus {
  width: 300px;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
}

.topnav-search-results {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  max-height: 480px;
  overflow-y: auto;
  background: #14161c;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  z-index: 1000;
}

.topnav-search-results.open { display: block; }

.tns-group {
  padding: 7px 12px 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #5b6068;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.tns-group:first-child { border-top: none; }

.tns-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 6px 12px;
  background: none;
  border: none;
  color: #d6d9de;
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.tns-item:hover, .tns-item.active {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.tns-item img {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
}

.tns-item img.round { border-radius: 50%; }

.tns-item .tns-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tns-item .tns-sub {
  flex-shrink: 0;
  font-size: 11px;
  color: #6b7280;
}

.tns-empty {
  padding: 14px 12px;
  font-size: 12px;
  color: #5b6068;
  font-style: italic;
}

@media (max-width: 1200px) {
  .topnav-search input { width: 160px; }
  .topnav-search input:focus { width: 220px; }
}

.topnav-search { flex-shrink: 1; min-width: 0; }
@media (max-width: 900px) {
  .topnav-search input { width: 120px; }
  .topnav-search input:focus { width: 160px; }
}
@media (max-width: 700px) {
  .topnav-search { display: none; }
}

/* Global search: temporarily hidden (remove this rule to re-enable) */
.topnav-search { display: none !important; }
