/* ==========================================================================
   TRADEORBIT RESPONSIVE PWA & MOBILE NAVIGATION SYSTEM
   Fixed Bottom Navigation + Dynamic More Menu Bottom Sheet Drawer
   Colors: Primary Electric Blue (#0b5cff) & Secondary Radiant Gold (#d4af37)
   ========================================================================== */

:root {
  --to-nav-bg: rgba(9, 14, 29, 0.96);
  --to-nav-border: rgba(255, 255, 255, 0.08);
  --to-nav-primary: #0b5cff;
  --to-nav-primary-glow: rgba(11, 92, 255, 0.45);
  --to-nav-gold: #d4af37;
  --to-nav-gold-glow: rgba(212, 175, 55, 0.4);
  --to-nav-cyan: #00d2ff;
  --to-nav-text-main: #f8fafc;
  --to-nav-text-muted: #94a3b8;
  --to-nav-sheet-bg: #090e1c;
  --to-nav-sheet-card: rgba(16, 24, 45, 0.85);
  --to-nav-height: 64px;
}

/* --------------------------------------------------------------------------
   1. FIXED BOTTOM NAVIGATION BAR
   -------------------------------------------------------------------------- */
.to-mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: calc(var(--to-nav-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--to-nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--to-nav-border);
  box-shadow: 0 -4px 28px rgba(0, 0, 0, 0.65), 0 -1px 0 rgba(255, 255, 255, 0.05);
  z-index: 1050;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.to-bottom-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: var(--to-nav-height);
  max-width: 600px;
  margin: 0 auto;
  padding: 0 0.5rem;
}

/* Individual Bottom Nav Item */
.to-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0.35rem 0.25rem 0.25rem;
  background: transparent;
  border: none;
  color: var(--to-nav-text-muted);
  text-decoration: none;
  font-family: inherit;
  cursor: pointer;
  position: relative;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.to-nav-item:hover,
.to-nav-item:focus {
  color: #e2e8f0;
  text-decoration: none;
}

.to-nav-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 28px;
  border-radius: 12px;
  transition: all 0.25s ease;
}

.to-nav-icon-wrap i {
  font-size: 1.45rem;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.25s ease;
}

.to-nav-label {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-top: 2px;
  line-height: 1;
  transition: all 0.25s ease;
}

/* Active State for Bottom Nav Items */
.to-nav-item.active {
  color: #ffffff;
}

.to-nav-item.active .to-nav-icon-wrap {
  background: rgba(11, 92, 255, 0.2);
  color: var(--to-nav-cyan);
  box-shadow: 0 0 16px rgba(11, 92, 255, 0.45);
}

.to-nav-item.active .to-nav-icon-wrap i {
  transform: translateY(-1px) scale(1.1);
  color: #00d2ff;
}

.to-nav-item.active .to-nav-label {
  color: #00d2ff;
  font-weight: 700;
}

/* Active Indicator dot */
.to-nav-item.active::after {
  content: '';
  position: absolute;
  top: 4px;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #0b5cff 0%, #00d2ff 100%);
  box-shadow: 0 0 8px rgba(0, 210, 255, 0.8);
}

/* --------------------------------------------------------------------------
   2. CONTENT SPACING (Avoid Content Hidden Behind Fixed Bottom Bar)
   -------------------------------------------------------------------------- */
@media (max-width: 1199.98px) {
  body {
    padding-bottom: calc(var(--to-nav-height) + env(safe-area-inset-bottom, 0px)) !important;
  }
  .content-wrapper {
    padding-bottom: calc(var(--to-nav-height) + env(safe-area-inset-bottom, 0px) + 1rem) !important;
  }
}

/* --------------------------------------------------------------------------
   3. MORE MENU BOTTOM SHEET & BACKDROP
   -------------------------------------------------------------------------- */
.to-more-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 7, 15, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1060;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s ease;
}

.to-more-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.to-more-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  max-height: 86vh;
  background: linear-gradient(180deg, #0c1426 0%, #080d19 100%);
  border-top: 1px solid rgba(0, 210, 255, 0.28);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.8), 0 0 35px rgba(11, 92, 255, 0.15);
  z-index: 1070;
  transform: translateY(105%);
  transition: transform 0.38s cubic-bezier(0.2, 0.95, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.to-more-sheet.show {
  transform: translateY(0);
}

/* Handle bar at top */
.to-sheet-handle-wrap {
  padding: 10px 0 6px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: grab;
  width: 100%;
}

.to-sheet-handle-bar {
  width: 44px;
  height: 5px;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 9999px;
  transition: background 0.2s ease, width 0.2s ease;
}

.to-sheet-handle-wrap:hover .to-sheet-handle-bar {
  background: rgba(0, 210, 255, 0.7);
  width: 52px;
}

/* Sheet Header */
.to-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.25rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.to-sheet-header-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.to-sheet-icon-box {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0b5cff 0%, #00d2ff 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  box-shadow: 0 4px 16px rgba(11, 92, 255, 0.45);
}

.to-sheet-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.to-sheet-subtitle {
  font-size: 0.78rem;
  color: var(--to-nav-text-muted);
  line-height: 1.2;
  margin-top: 2px;
}

.to-sheet-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.to-sheet-close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  transform: rotate(90deg);
}

/* Sheet Body / List */
.to-sheet-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.85rem 1.1rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
  -webkit-overflow-scrolling: touch;
}

/* Custom Scrollbar for Sheet */
.to-sheet-body::-webkit-scrollbar {
  width: 4px;
}
.to-sheet-body::-webkit-scrollbar-track {
  background: transparent;
}
.to-sheet-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.to-more-menu-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.to-more-header-divider {
  padding: 0.65rem 0.5rem 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 0.25rem;
}

/* More Menu Item (Card Style) */
.to-more-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem 1rem;
  background: var(--to-nav-sheet-card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  color: #ffffff;
  text-decoration: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.to-more-item:hover,
.to-more-item:focus {
  background: rgba(22, 33, 62, 0.95);
  border-color: rgba(0, 210, 255, 0.3);
  transform: translateY(-1px);
  color: #ffffff;
  text-decoration: none;
}

.to-more-item.is-active {
  border-color: rgba(0, 210, 255, 0.4);
  background: linear-gradient(135deg, rgba(11, 92, 255, 0.18) 0%, rgba(16, 24, 45, 0.95) 100%);
  box-shadow: 0 4px 18px rgba(11, 92, 255, 0.2);
}

/* Icon box with diverse colorful gradients matching mockup */
.to-more-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  color: #ffffff;
  flex-shrink: 0;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.to-more-item:hover .to-more-icon-box {
  transform: scale(1.06);
}

/* Colorful Gradient Variants */
.to-badge-blue {
  background: linear-gradient(135deg, #0b5cff 0%, #00d2ff 100%);
  box-shadow: 0 4px 14px rgba(11, 92, 255, 0.4);
}

.to-badge-emerald {
  background: linear-gradient(135deg, #00b09b 0%, #00e676 100%);
  box-shadow: 0 4px 14px rgba(0, 230, 118, 0.4);
}

.to-badge-amber {
  background: linear-gradient(135deg, #f59e0b 0%, #ffd700 100%);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

.to-badge-purple {
  background: linear-gradient(135deg, #7c4dff 0%, #b388ff 100%);
  box-shadow: 0 4px 14px rgba(124, 77, 255, 0.4);
}

.to-badge-teal {
  background: linear-gradient(135deg, #00bcd4 0%, #00e5ff 100%);
  box-shadow: 0 4px 14px rgba(0, 229, 255, 0.4);
}

.to-badge-rose {
  background: linear-gradient(135deg, #ff5252 0%, #ff7675 100%);
  box-shadow: 0 4px 14px rgba(255, 82, 82, 0.4);
}

.to-badge-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.to-more-text-wrap {
  flex-grow: 1;
  min-width: 0;
}

.to-more-item-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.25;
}

.to-more-item-sub {
  font-size: 0.76rem;
  color: var(--to-nav-text-muted);
  line-height: 1.25;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.to-more-arrow {
  color: #64748b;
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  transition: transform 0.25s ease, color 0.25s ease;
}

.to-more-item:hover .to-more-arrow {
  color: #ffffff;
  transform: translateX(3px);
}

/* Accordion open arrow rotation */
.to-more-group.to-group-open > .to-more-toggle .to-more-arrow {
  transform: rotate(90deg);
  color: var(--to-nav-cyan);
}

/* --------------------------------------------------------------------------
   4. SUBMENU ACCORDION PANEL
   -------------------------------------------------------------------------- */
.to-more-group {
  border-radius: 16px;
  transition: all 0.3s ease;
}

.to-more-group.to-group-open {
  background: rgba(13, 21, 40, 0.7);
  border: 1px solid rgba(0, 210, 255, 0.15);
}

.to-more-group.to-group-open > .to-more-toggle {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: transparent;
}

.to-more-submenu-panel {
  padding: 0.4rem 0.75rem 0.75rem 3.4rem;
  transition: max-height 0.3s ease;
}

.to-more-submenu-inner {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  border-left: 2px solid rgba(0, 210, 255, 0.25);
  padding-left: 0.75rem;
}

.to-more-sub-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  color: #94a3b8;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  background: transparent;
  transition: all 0.2s ease;
}

.to-more-sub-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
  text-decoration: none;
}

.to-more-sub-link.active {
  color: #00d2ff;
  font-weight: 700;
  background: rgba(11, 92, 255, 0.15);
  border: 1px solid rgba(0, 210, 255, 0.25);
}

.to-more-sub-bullet {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #64748b;
  margin-right: 0.65rem;
  display: inline-block;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.to-more-sub-link:hover .to-more-sub-bullet,
.to-more-sub-link.active .to-more-sub-bullet {
  background: #00d2ff;
  box-shadow: 0 0 6px rgba(0, 210, 255, 0.8);
}

.to-sub-active-badge {
  font-size: 1rem;
  color: #00d2ff;
}

/* --------------------------------------------------------------------------
   5. DESKTOP & TABLET RESPONSIVE RULES (Requirement 7)
   -------------------------------------------------------------------------- */
@media (min-width: 1200px) {
  /* On Desktop, hide bottom nav and more menu sheet entirely */
  .to-mobile-bottom-nav,
  .to-more-backdrop,
  .to-more-sheet {
    display: none !important;
  }
}

@media (max-width: 1199.98px) {
  /* On mobile and compact devices, hide desktop sidebar toggle by default if desired */
  .layout-menu-fixed .layout-menu {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }
}

/* Tablet — wider sheet, tighter spacing */
@media (min-width: 768px) and (max-width: 1199.98px) {
  .to-more-sheet {
    max-width: 520px;
    max-height: 75vh;
  }

  .to-more-menu-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
  }

  .to-more-header-divider {
    grid-column: 1 / -1;
  }

  .to-more-group {
    grid-column: 1 / -1;
  }
}

/* Touch device — enforce 44px min hit targets */
@media (pointer: coarse) {
  .to-nav-item {
    min-height: 48px;
  }

  .to-more-item {
    min-height: 54px;
  }

  .to-more-sub-link {
    min-height: 44px;
    padding: 0.55rem 0.75rem;
  }

  .to-sheet-close-btn {
    min-width: 44px;
    min-height: 44px;
  }
}

/* Prevent horizontal overflow on entire mobile document */
html, body {
  max-width: 100vw;
  overflow-x: hidden;
}

