/* ===== SHARED HEADER + SIDEBAR LAYOUT ===== */
/* emoji-header.css — single source of truth for header & sidebar styles */

/* ===== HEADER ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 10050;
  padding: 8px 0px 8px 20px;
  min-height: 50px;
  margin-left: 0;
  background-color: #131316;
  box-sizing: border-box;
}

.header-inner {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 50px;
  padding-left: 0;
  justify-content: flex-start;
  gap: 0;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  margin-right: auto;
}

.header-logo__icon {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  object-fit: contain;
}

.header-logo__text {
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 900;
  font-size: 1.18rem;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.header-logo__text span {
  color: #ff6200;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-right: 0;
}

/* ===== SOCIAL ICONS ===== */
.header-social {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.header-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: rgba(255, 255, 255, 0.45);
  text-decoration: none;
  border-radius: 6px;
  transition: color 0.3s ease, filter 0.3s ease, background 0.3s ease;
}

.header-social a:hover {
  color: #ff4d00;
  background: rgba(255, 77, 0, 0.08);
  filter: drop-shadow(0 0 6px rgba(255, 77, 0, 0.35));
}

.header-social svg {
  width: 15px;
  height: 15px;
}

/* ===== NAV ACTIVE STATE ===== */
.header-nav a.nav-active {
  color: #ff4d00;
}

/* ===== HAMBURGER TOGGLE (mobile only) ===== */
.sidebar-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  padding: 4px;
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform-origin: center;
}

.sidebar-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.sidebar-toggle.active span:nth-child(2) {
  opacity: 0;
}

.sidebar-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ===== SIDEBAR OVERLAY ===== */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  z-index: 10040;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: 56px;
  left: 0;
  width: 70px;
  height: calc(100vh - 56px);
  background: #131316;
  border-right: 1px solid #1f1f23;
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 10030;
  transition: width 0.3s ease;
  display: flex;
  flex-direction: column;
}

.sidebar::-webkit-scrollbar {
  width: 0;
}

.sidebar:hover {
  width: 240px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  flex: 1;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-section:last-child {
  border-bottom: none;
  margin-top: auto;
  padding-bottom: 16px;
}

.sidebar-section--footer {
  margin-top: auto;
}

.sidebar-section__label {
  display: block;
  padding: 10px 22px 4px;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.45);
  white-space: nowrap;
  overflow: hidden;
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  transition: opacity 0.3s ease, max-height 0.3s ease, padding 0.3s ease;
}

.sidebar:hover .sidebar-section__label {
  opacity: 1;
  max-height: 30px;
  padding: 10px 22px 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
  position: relative;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

.sidebar-link.active {
  color: #ff4d00;
  background: rgba(255, 77, 0, 0.06);
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: #ff4d00;
  border-radius: 0 3px 3px 0;
}

.sidebar-icon {
  flex: 0 0 30px;
  width: 30px;
  text-align: center;
  font-size: 1.35rem;
  line-height: 1;
  color: #fff;
  opacity: 1;
  font-style: normal;
  -webkit-text-stroke: 0;
  text-shadow: 0 0 0 transparent;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
}

.sidebar-text {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar:hover .sidebar-text {
  opacity: 1;
}

/* ===== SIDEBAR DROPDOWN ===== */
.sidebar-dropdown {
  display: flex;
  flex-direction: column;
}

.sidebar-dropdown__toggle {
  display: flex;
  align-items: center;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.sidebar-dropdown__arrow {
  margin-left: auto;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.3);
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform: rotate(0deg);
  opacity: 0;
  flex-shrink: 0;
}

.sidebar:hover .sidebar-dropdown__arrow {
  opacity: 1;
}

.sidebar-dropdown.open .sidebar-dropdown__arrow {
  transform: rotate(90deg);
  color: #ff4d00;
}

.sidebar-dropdown__menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.sidebar-dropdown.open .sidebar-dropdown__menu {
  max-height: 500px;
}

.sidebar-link--sub {
  padding-left: 38px;
  font-size: 0.75rem;
  padding-top: 7px;
  padding-bottom: 7px;
}

/* ===== MAIN CONTENT SHIFT FOR SIDEBAR ===== */
main,
.site-footer {
  margin-left: 70px;
  transition: margin-left 0.3s ease;
}

/* ===== BODY PADDING BELOW FIXED HEADER ===== */
body.has-shared-layout {
  padding-top: 70px;
}

/* ===== SIDEBAR RESPONSIVE ===== */
@media (min-width: 769px) {
  .sidebar-toggle {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .sidebar-toggle {
    display: flex;
    margin-right: 10px;
  }

  /* Mobile drawer: stable fixed drawer sliding from the left */
  .sidebar,
  .sidebar:hover {
    width: 240px !important;
    max-width: 80vw !important;
    left: 0 !important;
    top: 48px !important;
    /* Start exactly below the mobile header */
    height: calc(100dvh - 48px) !important;
    /* Respect dynamic viewport */
    padding-top: 10px !important;
    padding-bottom: calc(16px + env(safe-area-inset-bottom)) !important;
    transform: translateX(-100%) !important;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    z-index: 10030 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    background: #131316 !important;
    border-right: 1px solid rgba(255, 255, 255, 0.05) !important;
    box-shadow: none !important;
  }

  .sidebar.active {
    transform: translateX(0) !important;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5) !important;
  }

  body.sidebar-open {
    overflow: hidden !important;
    touch-action: none !important;
    overscroll-behavior: none !important;
  }

  .sidebar-nav {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: max-content;
  }

  .sidebar * {
    touch-action: manipulation;
  }

  /* ensure overlay stacks below sidebar but covers body */
  .sidebar-overlay {
    top: 48px !important;
    height: calc(100dvh - 48px) !important;
    z-index: 10020 !important;
  }

  /* Force text, arrows, and labels to be immediately visible on mount */
  .sidebar-text,
  .sidebar-section__label {
    opacity: 1 !important;
    transition: none !important;
  }

  .sidebar-dropdown__arrow {
    opacity: 1 !important;
    transition: none !important;
    margin-left: 14px !important;
  }

  .sidebar-section__label {
    max-height: none !important;
    padding: 10px 22px 4px !important;
  }

  main,
  .site-footer {
    margin-left: 0;
  }

  .header {
    padding: 8px 14px;
    min-height: 48px;
    margin-left: 0;
  }

  .sidebar-toggle {
    width: 26px;
    height: 26px;
    padding: 3px;
  }

  .sidebar-toggle span {
    width: 16px;
    height: 1.5px;
  }

  .header-social {
    gap: 6px;
  }

  .header-social a {
    width: 24px;
    height: 24px;
  }

  .header-social svg {
    width: 13px;
    height: 13px;
  }
}

@media (max-width: 480px) {
  .sidebar-toggle {
    width: 22px;
    height: 22px;
    padding: 2px;
    gap: 3.5px;
  }

  .sidebar-toggle span {
    width: 14px;
    height: 1.5px;
  }

  .header-logo__text {
    font-size: 0.95rem;
  }

  .header-social {
    gap: 4px;
  }

  .header-social a {
    width: 20px;
    height: 20px;
  }

  .header-social svg {
    width: 11px;
    height: 11px;
  }

  .header-right {
    gap: 8px;
  }

  .header {
    padding: 6px 10px 6px 12px;
    min-height: 40px;
  }

  .header-inner {
    min-height: 40px;
  }

  /* Adjust sidebar positions for smaller header */
  .sidebar,
  .sidebar:hover {
    top: 40px !important;
    height: calc(100dvh - 40px) !important;
  }

  .sidebar-overlay {
    top: 40px !important;
    height: calc(100dvh - 40px) !important;
  }
}