/*
 * Vibeforge Mobile Facebook-Style Hamburger Menu
 * Slide-out menu for mobile devices only
 */

/* Hamburger Menu Button - Mobile Only */
@media (max-width: 991px) {
  .hamburger-menu-btn {
    display: flex !important;
  }
}

.hamburger-menu-btn {
  width: 40px;
  min-width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.hamburger-menu-btn:hover {
  background: rgba(17, 142, 213, 0.1);
  background: color-mix(in srgb, var(--link-color, #118ed5) 10%, transparent);
}

.hamburger-menu-btn .hamburger-icon {
  width: 20px;
  height: 16px;
  position: relative;
}

.footer-bottom-bar .footer-hamburger-btn {
  width: 100%;
  min-width: 0;
  height: 100%;
  border-radius: 0;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  color: inherit;
}

.footer-bottom-bar .footer-hamburger-btn:hover,
.footer-bottom-bar .footer-hamburger-btn.active {
  background: transparent;
}

.footer-bottom-bar .footer-hamburger-btn .header-icon {
  width: 24px !important;
  height: 24px !important;
  color: currentColor;
}

.hamburger-menu-btn .hamburger-icon span {
  display: block;
  position: absolute;
  height: 2px;
  width: 100%;
  background: currentColor;
  border-radius: 2px;
  opacity: 1;
  left: 0;
  transform: rotate(0deg);
  transition: all 0.3s ease;
}

.hamburger-menu-btn .hamburger-icon span:nth-child(1) { top: 0; }
.hamburger-menu-btn .hamburger-icon span:nth-child(2) { top: 7px; }
.hamburger-menu-btn .hamburger-icon span:nth-child(3) { top: 14px; }

/* Animated X when open */
.hamburger-menu-btn.active .hamburger-icon span:nth-child(1) {
  top: 7px;
  transform: rotate(45deg);
}
.hamburger-menu-btn.active .hamburger-icon span:nth-child(2) { opacity: 0; }
.hamburger-menu-btn.active .hamburger-icon span:nth-child(3) {
  top: 7px;
  transform: rotate(-45deg);
}

/* Menu Overlay */
.hamburger-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 9999;
}

.hamburger-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Slide-out Menu Panel */
.hamburger-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 300px;
  max-width: 85vw;
  height: 100vh;
  height: 100dvh;
  height: var(--app-viewport-height, 100dvh);
  background: #fff;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 10000;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
}

.hamburger-panel.active {
  transform: translateX(0);
}

/* Panel Header */
.hamburger-panel-header {
  padding: 14px 14px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #eee;
  background: linear-gradient(135deg, var(--vf-ui-accent-strong, var(--link-color, #118ed5)) 0%, var(--vf-ui-accent, var(--link-color, #118ed5)) 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 2;
}

.hamburger-panel-header-link {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.hamburger-panel-header-link:hover {
  color: inherit;
  text-decoration: none;
}

.hamburger-panel-header .user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  flex: 0 0 48px;
}

.hamburger-guest-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 48px;
  background: rgba(255, 255, 255, 0.18);
  border: 2px solid rgba(255, 255, 255, 0.7);
}

.hamburger-guest-avatar .menu-icon {
  width: 24px;
  height: 24px;
  color: #fff;
}

.hamburger-panel-header .user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.hamburger-panel-header .user-name {
  font-weight: 600;
  font-size: 16px;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hamburger-panel-header .user-username {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hamburger-close-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 40px;
}

.hamburger-close-btn:hover,
.hamburger-close-btn:focus-visible {
  background: rgba(255, 255, 255, 0.24);
}

/* Menu Sections */
.hamburger-menu-section {
  padding: 10px 0;
  border-bottom: 1px solid #eee;
}

.hamburger-menu-section:last-child {
  border-bottom: none;
}

/* Menu Items */
.hamburger-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 11px 16px;
  color: var(--body-color, #333);
  text-decoration: none;
  transition: background 0.2s ease;
  cursor: pointer;
}

.hamburger-menu-item:hover,
.hamburger-menu-item:focus-visible,
.hamburger-menu-item.active {
  background: rgba(17, 142, 213, 0.1);
  background: color-mix(in srgb, var(--link-color, #118ed5) 10%, transparent);
  text-decoration: none;
}

.hamburger-menu-item .menu-icon {
  width: 24px;
  height: 24px;
  color: var(--link-color, #118ed5);
  flex: 0 0 24px;
}

.hamburger-menu-item .menu-text {
  flex: 1;
  font-size: 15px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hamburger-menu-item .menu-badge {
  background: #e74c3c;
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
}

.hamburger-quick-grid,
.hamburger-menu-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
}

.hamburger-quick-grid {
  background: var(--vf-ui-surface-alt, #f8f9fa);
  border-bottom: 1px solid #eee;
}

.hamburger-menu-grid {
  padding-top: 4px;
}

.hamburger-menu-compact-item {
  min-height: 76px;
  padding: 10px 6px;
  border-radius: 12px;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  text-align: center;
  background: var(--vf-ui-surface-alt, #f7f9fc);
}

.hamburger-menu-compact-item .menu-icon {
  margin: 0;
}

.hamburger-menu-compact-item .menu-text {
  flex: 0 1 auto;
  max-width: 100%;
  font-size: 12px;
  font-weight: 600;
}

/* Section Title */
.hamburger-menu-title {
  padding: 12px 16px 8px;
  font-size: 12px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Quick Stats */
.hamburger-stats {
  display: flex;
  padding: 12px 16px;
  gap: 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #eee;
}

.hamburger-stat {
  text-align: center;
}

.hamburger-stat-value {
  font-weight: 600;
  font-size: 16px;
  display: block;
}

.hamburger-stat-label {
  font-size: 11px;
  color: #888;
}

/* Night mode support */
body.night-mode .hamburger-menu-btn .hamburger-icon span {
  background: #fff;
}

body.night-mode .hamburger-panel {
  background: #1c1c1e;
}

body.night-mode .hamburger-panel-header {
  border-bottom-color: #333;
}

body.night-mode .hamburger-menu-item {
  color: #fff;
}

body.night-mode .hamburger-menu-item:hover {
  background: #2c2c2e;
}

body.night-mode .hamburger-menu-item:focus-visible,
body.night-mode .hamburger-menu-item.active {
  background: #2c2c2e;
}

body.night-mode .hamburger-menu-item .menu-icon {
  color: #4c9fff;
}

body.night-mode .hamburger-menu-title {
  color: #888;
}

body.night-mode .hamburger-menu-section {
  border-bottom-color: #333;
}

body.night-mode .hamburger-stats {
  background: #2c2c2e;
}

body.night-mode .hamburger-quick-grid {
  background: #222326;
  border-bottom-color: #333;
}

body.night-mode .hamburger-menu-compact-item {
  background: #242529;
}

body.night-mode .hamburger-menu-compact-item:hover,
body.night-mode .hamburger-menu-compact-item:focus-visible,
body.night-mode .hamburger-menu-compact-item.active {
  background: #303136;
}

/* Responsive */
@media (max-width: 575px) {
  .hamburger-panel {
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 360px) {
  .hamburger-quick-grid,
  .hamburger-menu-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Mobile settings navigation */
@media (max-width: 767.98px) {
  .vf-settings-shell {
    overflow: visible;
  }

  .vf-settings-shell .vf-settings-sidebar {
    position: fixed !important;
    top: 0;
    bottom: 0;
    left: -100%;
    width: 100%;
    max-width: 100%;
    z-index: 10050;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--vf-ui-surface, #fff);
    transition: left 0.25s ease-out;
  }

  .vf-settings-shell.active .vf-settings-sidebar {
    left: 0;
  }

  .vf-settings-shell.active .sg-offcanvas-mainbar {
    left: 0;
  }

  .vf-settings-nav-card {
    min-height: 100vh;
    min-height: 100dvh;
    min-height: var(--app-viewport-height, 100dvh);
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: var(--vf-ui-surface, #fff);
  }

  .vf-settings-nav-card .card-body.with-nav {
    padding: 0 12px 24px;
  }

  .vf-settings-nav-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 -12px 12px;
    padding: calc(14px + env(safe-area-inset-top, 0px)) 14px 14px;
    color: #fff;
    background: linear-gradient(135deg, var(--vf-ui-accent-strong, var(--link-color, #118ed5)) 0%, var(--vf-ui-accent, var(--link-color, #118ed5)) 100%);
  }

  .vf-settings-nav-eyebrow {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.8;
  }

  .vf-settings-nav-title {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.1;
  }

  .vf-settings-nav-close {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 40px;
  }

  .vf-settings-mobile-bar {
    margin: 0 0 10px;
  }

  .vf-settings-mobile-button {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(17, 142, 213, 0.18);
    border-radius: 12px;
    padding: 11px 13px;
    color: var(--link-color, #118ed5);
    background: rgba(17, 142, 213, 0.08);
    font-weight: 700;
  }

  .vf-settings-mobile-button .main-icon {
    flex: 0 0 20px;
  }

  .vf-settings-mobile-button span {
    flex: 1;
    text-align: left;
  }

  .vf-settings-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 0;
  }

  .vf-settings-nav > .divider {
    display: none;
  }

  .vf-settings-nav > li {
    min-width: 0;
  }

  .vf-settings-nav > li:has(> .collapse) {
    grid-column: 1 / -1;
  }

  .vf-settings-nav > li > a {
    min-height: 78px;
    padding: 10px 8px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    text-align: center;
    background: var(--vf-ui-surface-alt, #f7f9fc);
    color: var(--body-color, #333);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
  }

  .vf-settings-nav > li:has(> .collapse) > a {
    min-height: 58px;
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
    padding: 11px 12px;
  }

  .vf-settings-nav > li > a:hover,
  .vf-settings-nav > li > a:focus-visible,
  .vf-settings-nav > li.active > a {
    color: #fff;
    background: var(--link-color, #118ed5);
    box-shadow: 0 10px 22px rgba(17, 142, 213, 0.18);
  }

  .vf-settings-nav > li:has(> .collapse) > a:hover,
  .vf-settings-nav > li:has(> .collapse) > a:focus-visible,
  .vf-settings-nav > li:has(> .collapse).active > a {
    color: var(--body-color, #333);
    background: var(--vf-ui-surface-alt, #f7f9fc);
    box-shadow: none;
  }

  .vf-settings-nav > li > a:hover .main-icon,
  .vf-settings-nav > li > a:focus-visible .main-icon,
  .vf-settings-nav > li.active > a .main-icon {
    color: #fff;
  }

  .vf-settings-nav > li:has(> .collapse) > a:hover .main-icon,
  .vf-settings-nav > li:has(> .collapse) > a:focus-visible .main-icon,
  .vf-settings-nav > li:has(> .collapse).active > a .main-icon {
    color: var(--link-color, #118ed5);
  }

  .vf-settings-nav > li > a .main-icon {
    width: 24px !important;
    height: 24px !important;
    margin-right: 0 !important;
    color: var(--link-color, #118ed5);
    flex: 0 0 24px;
  }

  .vf-settings-nav a[data-bs-toggle="collapse"]:after {
    display: none;
  }

  .vf-settings-nav .collapse {
    display: block !important;
    height: auto !important;
    visibility: visible !important;
  }

  .vf-settings-nav .collapse ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 8px 0 2px;
    margin: 0;
    padding-left: 0;
    list-style: none;
    overflow: visible;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .vf-settings-nav .collapse li {
    min-width: 0;
    max-width: 100%;
  }

  .vf-settings-nav .collapse li a {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 7px 8px;
    margin-left: 0 !important;
    border-left: 0 !important;
    white-space: normal;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-secondary, #6b7280);
    background: var(--vf-ui-surface-alt, #f7f9fc);
  }

  .vf-settings-nav .collapse li.active a,
  .vf-settings-nav .collapse li a:hover,
  .vf-settings-nav .collapse li a:focus-visible {
    color: var(--link-color, #118ed5);
    background: rgba(17, 142, 213, 0.1);
    background: color-mix(in srgb, var(--link-color, #118ed5) 10%, transparent);
  }
}

@media (max-width: 380px) {
  .vf-settings-nav {
    grid-template-columns: 1fr;
  }

  .vf-settings-nav > li > a,
  .vf-settings-nav > li:has(> .collapse) > a {
    min-height: 58px;
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
    padding: 11px 12px;
  }

  .vf-settings-nav .collapse ul {
    grid-template-columns: 1fr;
  }
}

body.night-mode .vf-settings-shell .vf-settings-sidebar,
body.night-mode .vf-settings-nav-card {
  background: #1c1c1e;
}

body.night-mode .vf-settings-nav > li > a,
body.night-mode .vf-settings-nav .collapse li a {
  background: #242529;
  color: #fff;
}

body.night-mode .vf-settings-mobile-button,
body.night-mode .vf-settings-nav > li > a:hover,
body.night-mode .vf-settings-nav > li > a:focus-visible,
body.night-mode .vf-settings-nav > li.active > a,
body.night-mode .vf-settings-nav .collapse li.active a,
body.night-mode .vf-settings-nav .collapse li a:hover,
body.night-mode .vf-settings-nav .collapse li a:focus-visible {
  background: var(--link-color, #4c9fff);
  color: #fff;
}

body.night-mode .vf-settings-nav > li:has(> .collapse) > a:hover,
body.night-mode .vf-settings-nav > li:has(> .collapse) > a:focus-visible,
body.night-mode .vf-settings-nav > li:has(> .collapse).active > a {
  background: #242529;
  color: #fff;
  box-shadow: none;
}

body.night-mode .vf-settings-nav > li > a:hover .main-icon,
body.night-mode .vf-settings-nav > li > a:focus-visible .main-icon,
body.night-mode .vf-settings-nav > li.active > a .main-icon {
  color: #fff;
}

body.night-mode .vf-settings-nav > li:has(> .collapse) > a:hover .main-icon,
body.night-mode .vf-settings-nav > li:has(> .collapse) > a:focus-visible .main-icon,
body.night-mode .vf-settings-nav > li:has(> .collapse).active > a .main-icon {
  color: var(--link-color, #4c9fff);
}
