@import url("/utils/components/theme.css");

/* =============================================
   MEGA NAVIGATION – NEO-BRUTALIST & KID FRIENDLY
   ============================================= */

/* ----- GLOBAL NAV BAR (STICKY FIXED) ----- */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--paper);
  padding: 0 1.5rem;
  height: 80px;
  /* Brutalist thick border */
  border-bottom: 3px solid var(--ink);
  font-family: var(--font-mono);
  transition: all 0.2s ease;
}

body {
  padding-top: 80px; /* Prevent content hiding under navbar */
}

/* =============================================
   LOGO
   ============================================= */
.nav-brand-wrap {
  display: flex;
  align-items: center;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-logo img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 12px;
  border: 2px solid var(--ink);
  background: var(--yellow);
}

.nav-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-top {
  font-weight: 900;
  font-size: 1.2rem;
  font-family: var(--font-display);
  letter-spacing: -0.5px;
}

.brand-bottom {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

/* =============================================
   MAIN LINKS BASE
   ============================================= */
.site-nav .nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
  height: 100%;
}

.site-nav .nav-links > li {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
}

/* MAIN LABEL (CLICKABLE ON MOBILE, HOVER ON DESKTOP) */
.nav-main-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.site-nav .nav-links > li:hover .nav-main-label {
  background: var(--yellow);
  border: 2px solid var(--ink);
  transform: translateY(-2px);
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
}

/* =============================================
   MEGA PANEL (FLOATING BRUTALIST BOX)
   ============================================= */
.mega-panel {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(15px);
  width: 100%;
  max-height: calc(100vh - 150px);
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 0 0 16px 16px;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 9998;

  overflow-y: auto;
}

.mega-panel::before {
  display: none;
}

.nav-links > li:hover .mega-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.mega-panel-content {
  display: flex;
  gap: 2rem;
  justify-content: center;
  align-items: flex-start;
  min-height: fit-content;
}

/* =============================================
   RECURSIVE TREE SYSTEM
   ============================================= */
.mega-tree {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* LEVEL 1 (Main Columns) */
.nav-level-1 {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  width: 100%;
  justify-content: center;
}

/* LEVEL 2 (Sub Groups) */
.nav-level-2 {
  display: flex;
  flex-direction: column;
  min-width: 180px;
  flex: 1;
  gap: 0.5rem;
}

/* BLOCK WRAPPER */
.nav-block {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: 12px;
  padding: 0.75rem;
  transition: transform 0.2s ease;
  min-width: 200px;
}

.nav-block:hover {
  transform: translateY(-3px);
}

/* Colorful Theme Accents per block */
.nav-block.theme-yellow .nav-header .nav-icon {
  background: var(--yellow);
}
.nav-block.theme-blue .nav-header .nav-icon {
  background: var(--blue);
  color: #fff;
}
.nav-block.theme-green .nav-header .nav-icon {
  background: var(--green);
  color: #fff;
}
.nav-block.theme-red .nav-header .nav-icon {
  background: var(--red);
  color: #fff;
}

/* GROUP HEADER */
.nav-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--ink);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px dashed var(--ink);
}

.nav-header .nav-icon {
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 4px;
  width: 28px;
  height: 28px;
}

/* LEAF LINKS (Clickable Items) */
.nav-leaf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  padding: 0.3rem;
  /* border-radius: 8px; */
  border-bottom: 2px dotted transparent;
  background: transparent;
  color: var(--ink);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-leaf-text {
  display: flex;
  flex-direction: column;
}

.nav-leaf-title {
  font-weight: 700;
  font-size: 0.85rem;
}

.nav-leaf small {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1;
}

.nav-leaf-arrow {
  opacity: 0;
  transform: translateX(-10px);
  color: var(--ink);
  width: 20px;
  height: 20px;
  transition: all 0.2s ease;
}

.nav-leaf:hover {
  background: var(--paper);
  border-color: var(--ink);
  transform: translateX(4px);
}

.nav-leaf:hover .nav-leaf-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* =============================================
   MEGA IMAGE
   ============================================= */
.mega-image {
  width: 250px;
  height: 100%;
  max-height: 500px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--yellow);
  overflow: hidden;
  align-self: stretch;
}

.mega-image img,
.mega-image svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* =============================================
   USER MENU & RIGHT SIDE
   ============================================= */
.nav-right-wrap {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

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

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  border: 2px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  font-family: var(--font-display);
  transition: transform 0.2s;
}

.user-profile:hover .user-avatar {
  transform: scale(1.1) rotate(5deg);
}

.user-name {
  font-weight: 700;
  font-size: 0.9rem;
  display: none; /* Hide on smaller screens */
}

@media (min-width: 1024px) {
  .user-name {
    display: block;
  }
}

.logout-btn {
  background: var(--red);
  color: #fff;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 800;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.logout-btn:hover {
  transform: translate(-2px, -2px);
}

.logout-btn:active {
  transform: translate(2px, 2px);
}

/* =============================================
   MOBILE TOGGLE (HAMBURGER)
   ============================================= */
.nav-toggle {
  display: none;
  flex-direction: column;
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 8px;
  gap: 5px;
  cursor: pointer;
  transition: transform 0.1s;
}

.nav-toggle:active {
  transform: translate(2px, 2px);
}

.nav-toggle span {
  width: 24px;
  height: 3px;
  background: var(--ink);
  border-radius: 2px;
  transition: 0.3s;
}

.nav-toggle.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 6px);
}
.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}
.nav-toggle.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -6px);
}

/* =============================================
   MOBILE RESPONSIVE
   ============================================= */
@media (max-width: 900px) {
  .mega-image {
    display: none;
  }

  .mega-panel {
    width: calc(100vw - 20px);
    padding: 1.5rem;
  }
}

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

  .nav-toggle {
    display: flex;
  }

  .user-menu {
    display: none;
  }

  /* Mobile Dropdown Wrapper */
  .site-nav .nav-links {
    position: fixed;
    top: 80px;
    left: 0;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;

    background: var(--bg);
    border-top: 3px solid var(--ink);
    border-bottom: 3px solid var(--ink);

    padding: 1rem;
    gap: 0.5rem;

    max-height: calc(100vh - 80px);
    overflow-y: auto;

    display: none;
  }

  .site-nav .nav-links.open {
    display: flex;
  }

  .site-nav .nav-links > li {
    width: 100%;
    height: auto;
    flex-direction: column;
  }

  .nav-main-label {
    width: 100%;
    justify-content: space-between;
    padding: 1rem;
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: 10px;
  }

  .nav-main-label::after {
    content: "+";
    font-size: 1.2rem;
    font-weight: 900;
  }

  .site-nav .nav-links > li.open .nav-main-label {
    background: var(--yellow);
  }

  .site-nav .nav-links > li.open .nav-main-label::after {
    content: "-";
  }

  /* Reset Mega Panel for Mobile Accordion */
  .mega-panel {
    position: static;
    width: 100%;
    max-width: none;
    max-height: none;
    transform: none;
    border: none;
    padding: 1rem 0 0.5rem 0;
    background: transparent;
    display: none;
    overflow-y: visible;
  }

  .mega-panel::before {
    display: none;
  }

  .nav-links > li.open .mega-panel {
    display: block;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .mega-panel-content {
    flex-direction: column;
    gap: 1.5rem;
    min-height: 0;
  }

  .mega-tree {
    flex-direction: column;
    justify-content: flex-start;
  }

  .nav-level-1 {
    flex-direction: column;
    gap: 1rem;
    justify-content: flex-start;
  }

  .nav-level-2 {
    min-width: auto;
  }

  .nav-block {
    border-width: 2px;
    min-width: auto;
  }
}
