/* =========================================================
   menu.css
   ========================================================= */

/* 1. The Tab Bar Container */
.mobile-bottom-nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 448px;
  height: 65px;
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid rgba(229, 231, 235, 0.5); /* softer gray border */
  z-index: 9999;
  padding-bottom: env(safe-area-inset-bottom);
  box-sizing: content-box;
  box-shadow: 0 -10px 30px -10px rgba(0, 0, 0, 0.05); /* Wider, softer shadow */
}

/* 2. Prevent the main app card from hiding behind the tab bar */
body {
  padding-bottom: calc(75px + env(safe-area-inset-bottom)) !important;
}

/* --- UNIVERSAL SPLASH SCREEN --- */
#splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(
    to right,
    #f3f4f6 0%,
    #ede9fe 20%,
    #ede9fe 80%,
    #f3f4f6 100%
  );
  z-index: 100000; /* Extremely high to cover everything */
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}
#splash-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  animation: pulse-splash 1.5s infinite;
}
.splash-content img {
  width: 6rem;
  height: 6rem;
  border-radius: 50%;
  border: 2px solid #a855f7;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
@keyframes pulse-splash {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.98); }
}

/* 3. Tab Button Styling */
.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  text-decoration: none;
  height: 100%;
  transition:
    color 0.2s ease-in-out,
    transform 0.1s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.nav-tab i {
  font-size: 1.25rem;
  margin-bottom: 3px;
  transition: transform 0.2s ease;
}

.nav-tab span {
  font-size: 0.65rem;
  font-weight: 600;
}

.nav-tab.active {
  color: #6b46c1;
}

.nav-tab.active i {
  transform: translateY(-2px);
}

.nav-tab:hover {
  color: #8b5cf6;
}

/* =========================================================
   TOP LEFT BACK BUTTON
   ========================================================= */
.top-left-back-btn {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid #e5e7eb;
  color: #6b7280;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.8rem;
  border-radius: 9999px;
  transition: all 0.2s ease;
  font-family: "Inter", sans-serif;
  z-index: 50;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.top-left-back-btn:hover {
  background: #ffffff;
  color: #7c3aed; /* Purple-600 */
  border-color: #d8b4fe; /* Purple-300 */
  transform: translateX(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

@media (max-width: 768px) {
  .top-left-back-btn {
    top: 1rem;
    left: 1rem;
    padding: 0.4rem 0.7rem;
    font-size: 0.85rem;
  }
}

/* =========================================================
   FLOATING BUTTONS (Dice & Back to Top)
   ========================================================= */
#back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  background-color: rgba(255, 255, 255, 0.95);
  color: #6b7280;
  font-size: 1.25rem;
  border: 1px solid #e5e7eb;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: pointer;
  display: none; /* Toggled by JS */
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  transition: all 0.3s ease-in-out;
  z-index: 1000;
  margin-bottom: calc(65px + env(safe-area-inset-bottom)) !important;
}

#back-to-top:hover {
  background-color: #ffffff;
  color: #7c3aed;
  border-color: #d8b4fe;
  transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15);
  opacity: 1;
}

#floating-dice {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  background-color: rgba(255, 255, 255, 0.95);
  color: #6b7280;
  border: 1px solid #e5e7eb;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  z-index: 1100;
  opacity: 0.85;
  transition: all 0.3s ease-in-out;
  margin-bottom: calc(65px + env(safe-area-inset-bottom)) !important;
}

#floating-dice:hover,
#floating-dice:focus {
  background-color: #ffffff;
  color: #7c3aed;
  border-color: #d8b4fe;
  transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15);
  outline: none;
  opacity: 1;
}

#floating-dice:active {
  transform: translateY(0) scale(0.98);
}

#floating-dice .fa-dice {
  font-size: 1.25rem;
}

@media (max-width: 480px) {
  #floating-dice,
  #back-to-top {
    width: 52px;
    height: 52px;
    bottom: 16px;
    right: 16px;
  }
  #floating-dice .fa-dice {
    font-size: 1.17rem;
  }
  #back-to-top {
    font-size: 1.15rem;
  }
}

/* =========================================================
   LOCKED FEATURE STYLING (Menu Items)
   ========================================================= */
.locked-feature {
  opacity: 0.5;
  pointer-events: none;
  filter: grayscale(1);
  position: relative;
  cursor: not-allowed;
}

.lock-wrapper {
  display: inline-flex;
  position: relative;
  cursor: pointer;
}

.lock-wrapper::after {
  content: "\f023";
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome";
  font-weight: 900;
  position: absolute;
  top: -8px;
  right: -8px;
  background: #fbbf24;
  color: white;
  width: 20px;
  height: 20px;
  font-size: 10px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  z-index: 50;
  transition: transform 0.2s;
}

.lock-wrapper:hover::after {
  transform: scale(1.1);
}

.lock-wrapper.host-only::after {
  background: #db2777; /* Deep Pink for Host features */
}

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

/* Tablet/Desktop View: Floating Pill Dock */
@media (min-width: 600px) {
  .mobile-bottom-nav {
    bottom: 2rem !important;
    border-radius: 9999px !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    box-shadow:
      0 10px 25px -5px rgba(0, 0, 0, 0.1),
      0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
    padding: 0 0.5rem !important;
  }

  body {
    padding-bottom: 120px !important;
  }

  /* Bumps existing floating buttons up to sit safely above the pill dock */
  #floating-dice,
  #floating-join,
  #floating-copy,
  #floating-lookup,
  #floating-collapse,
  #back-to-top,
  .toast-notification,
  #global-host-timer {
    margin-bottom: 90px !important;
  }

  /* Keep floating buttons tethered to the main app container instead of the far screen edge */
  #floating-dice,
  #floating-join,
  #floating-copy,
  #floating-lookup,
  #floating-collapse,
  #back-to-top {
    right: calc(50% - 224px + 20px) !important;
  }
}

/* =========================================================
   ACCESSIBILITY OVERRIDES
   ========================================================= */
.modal-content-card {
  max-height: 90vh;
  overflow-y: auto;
}
