/* ═══════════════════════════════════════════════════
   Mobile Navigation - Bottom Sheet + Tab Bar
   Active only on screens < 992px
   ═══════════════════════════════════════════════════ */

/* ── Bottom Tab Bar ── */
.mobile-tab-bar {
  display: none;
}

@media (max-width: 991px) {

  /* ── Bottom Tab Bar (always visible) ── */
  .mobile-tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    z-index: 99990;
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.06);
  }

  .tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.2px;
    transition: color 0.2s ease;
    position: relative;
    -webkit-tap-highlight-color: transparent;
  }

  .tab-item:hover,
  .tab-item:active {
    text-decoration: none;
  }

  .tab-item.active {
    color: #7c3aed;
  }

  .tab-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 18px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .tab-item.active .tab-icon {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(219, 140, 219, 0.12));
    transform: scale(1.05);
  }

  .tab-icon i {
    font-size: 18px;
  }

  .tab-label {
    line-height: 1;
  }

  /* Create button special style */
  .tab-item.tab-create .tab-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, #7c3aed 0%, #db8ade 100%);
    color: white;
    margin-top: -14px;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.35);
    font-size: 22px;
  }

  .tab-item.tab-create .tab-label {
    color: #7c3aed;
    font-weight: 700;
  }

  .tab-item.tab-create:active .tab-icon {
    transform: scale(0.92);
  }

  /* Notification dot on tab */
  .tab-notif-dot {
    position: absolute;
    top: 6px;
    right: calc(50% - 18px);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    border: 2px solid white;
    display: none;
  }

  .tab-notif-dot.show {
    display: block;
  }

  /* ── Body padding to account for tab bar ── */
  body {
    padding-bottom: 72px !important;
  }

  /* ── Ensure Cookie Consent stays above mobile tab bar ── */
  .cc-window {
    bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 99991 !important;
  }

  /* ── Hide old menu trigger (hamburger) ── */
  /* KEPT VISIBLE: hamburger and bell stay in header */
  /* Only hide the old slideToggle nav LIST when bottom sheet is present */
  .has-mobile-sheet .header-area .main-nav .nav {
    display: none !important;
  }







  /* ── Backdrop with blur ── */
  .mobile-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99995;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .mobile-sheet-backdrop.open {
    opacity: 1;
    visibility: visible;
  }

  /* ── Bottom Sheet Drawer ── */
  .mobile-bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 85vh;
    background: #ffffff;
    border-radius: 20px 20px 0 0;
    z-index: 99998;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .mobile-bottom-sheet.open {
    transform: translateY(0);
  }

  /* Drag handle */
  .sheet-handle {
    display: flex;
    justify-content: center;
    padding: 12px 0 4px;
    cursor: grab;
    flex-shrink: 0;
  }

  .sheet-handle::after {
    content: '';
    width: 36px;
    height: 4px;
    border-radius: 99px;
    background: #d1d5db;
  }

  /* ── Profile Card ── */
  .sheet-profile {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 24px 16px;
    flex-shrink: 0;
  }

  .sheet-avatar {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #7c3aed, #db8ade);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    font-weight: 800;
    flex-shrink: 0;
    letter-spacing: -0.5px;
  }

  .sheet-user-info {
    flex: 1;
    min-width: 0;
  }

  .sheet-user-name {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sheet-user-plan {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 99px;
    margin-top: 4px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
  }

  .sheet-user-plan.plan-gratuito {
    background: #f0fdf4;
    color: #16a34a;
  }

  .sheet-user-plan.plan-basic {
    background: #eff6ff;
    color: #2563eb;
  }

  .sheet-user-plan.plan-premium {
    background: linear-gradient(135deg, #faf5ff, #f3e8ff);
    color: #7c3aed;
  }

  /* ── Divider ── */
  .sheet-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 0 24px;
    flex-shrink: 0;
  }

  /* ── Navigation Items ── */
  .sheet-nav {
    padding: 12px 16px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
  }

  .sheet-nav-group {
    margin-bottom: 8px;
  }

  .sheet-nav-label {
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 12px 4px;
  }

  .sheet-nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 12px;
    border-radius: 14px;
    text-decoration: none;
    color: #334155;
    font-size: 15px;
    font-weight: 600;
    transition: background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .sheet-nav-item:hover,
  .sheet-nav-item:active {
    background: #f8fafc;
    text-decoration: none;
    color: #334155;
  }

  .sheet-nav-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
  }

  .sheet-nav-icon.icon-home { background: #eff6ff; color: #3b82f6; }
  .sheet-nav-icon.icon-lists { background: #faf5ff; color: #8b5cf6; }
  .sheet-nav-icon.icon-plans { background: #fefce8; color: #eab308; }
  .sheet-nav-icon.icon-edit { background: #f0fdf4; color: #22c55e; }
  .sheet-nav-icon.icon-subscription { background: #fdf2f8; color: #ec4899; }
  .sheet-nav-icon.icon-notifications { background: #fff7ed; color: #f97316; }
  .sheet-nav-icon.icon-contact { background: #f0f9ff; color: #0ea5e9; }
  .sheet-nav-icon.icon-privacy { background: #f5f3ff; color: #7c3aed; }
  .sheet-nav-icon.icon-terms { background: #f1f5f9; color: #64748b; }
  .sheet-nav-icon.icon-logout { background: #fef2f2; color: #ef4444; }

  .sheet-nav-text {
    flex: 1;
  }

  .sheet-nav-arrow {
    color: #cbd5e1;
    font-size: 12px;
  }

  /* Logout special style */
  .sheet-nav-item.item-logout {
    color: #ef4444;
    margin-top: 4px;
  }

  .sheet-nav-item.item-logout:hover,
  .sheet-nav-item.item-logout:active {
    background: #fef2f2;
  }

  /* ── Footer in sheet ── */
  .sheet-footer {
    padding: 12px 24px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    text-align: center;
    flex-shrink: 0;
    border-top: 1px solid #f1f5f9;
  }

  .sheet-footer-text {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
  }

  /* ── Trust strip & footer pushed up ── */
  .trust-strip {
    margin-bottom: 72px;
  }

  .ft-main-footer {
    margin-bottom: 64px;
  }

  /* ── Modals: ensure content is not hidden behind tab bar ── */
  .modal-body {
    padding-bottom: 80px !important;
  }

  .modal-footer {
    padding-bottom: calc(0px + 10px) !important;
  }

  /* Custom lv-modal used in lista.php */
  .lv-modal {
    padding-bottom: 80px !important;
  }

  .lv-modal .lv-modal-body {
    padding-bottom: 80px !important;
  }

  /* Bootstrap modal dialog - ensure it doesn't go behind tab bar */
  .modal-dialog {
    margin-bottom: 72px !important;
  }

  /* editListModal specific */
  #editListModal .modal-content,
  #editListModalContent {
    padding-bottom: 72px !important;
  }

  /* ── Preview toggle: push above tab bar ── */
  #previewToggleBtn,
  .preview-toggle-btn {
    bottom: 76px !important;
    transition: bottom 0.3s ease !important;
  }

  .preview-label {
    bottom: 140px !important;
    transition: bottom 0.3s ease !important;
  }

  /* ── Hide tab bar in visitor preview mode ── */
  .visitor-mode-active .mobile-tab-bar {
    display: none !important;
  }

  .visitor-mode-active {
    padding-bottom: 0 !important;
  }

  /* ── In visitor mode: preview button goes back to original position ── */
  .visitor-mode-active #previewToggleBtn,
  .visitor-mode-active .preview-toggle-btn {
    bottom: 30px !important;
  }

  .visitor-mode-active .preview-label {
    bottom: 100px !important;
  }

  /* ── Hide tab bar for non-admin visitors (applied via JS) ── */
  .hide-mobile-tab-bar .mobile-tab-bar {
    display: none !important;
  }

  .hide-mobile-tab-bar {
    padding-bottom: 0 !important;
  }
}

/* ── Desktop: ensure nothing leaks ── */
@media (min-width: 992px) {
  .mobile-tab-bar,
  .mobile-bottom-sheet,
  .mobile-sheet-backdrop {
    display: none !important;
  }
}
