/* Bottom Navigation — mobile-only persistent tab bar */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4rem;
    display: none; /* hidden by default, shown on mobile */
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    z-index: 150;
    padding: 0;
    margin: 0;
    align-items: center;
}

.bottom-nav-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast, 150ms ease);
    min-height: 3rem; /* 48px touch target */
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-tab.active {
    color: var(--accent-terracotta);
}

.bottom-nav-tab:hover {
    color: var(--text-primary);
}

.bottom-nav-tab-icon {
    width: 1.5rem;
    height: 1.5rem;
}

.bottom-nav-tab-icon svg {
    width: 100%;
    height: 100%;
}

.bottom-nav-tab-label {
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

.bottom-nav-badge {
    position: absolute;
    top: 0.25rem;
    right: 50%;
    transform: translateX(calc(50% + 0.75rem));
    min-width: 1rem;
    height: 1rem;
    background: var(--accent-terracotta);
    border-radius: 9999px;
    font-size: 0.625rem;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.25rem;
}

/* Center FAB — raised floating action button */
.bottom-nav-fab {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 3.5rem;
    height: 3.5rem;
    margin-top: -1.5rem;
    border-radius: 50%;
    background: var(--accent-terracotta, #c75b39);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 10;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-fab:active {
    transform: scale(0.95);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.bottom-nav-fab .bottom-nav-tab-icon {
    font-size: 1.5rem;
}

/* Bottom sheet backdrop — hidden on desktop */
.mobile-app-sheet-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 998;
}

/* Bottom sheet container — hidden on desktop */
.mobile-app-sheet {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 4rem; /* above bottom nav */
    max-height: 70vh;
    background: var(--bg-primary, #fff);
    border-radius: 1rem 1rem 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    transform: translateY(calc(100% + 4rem)); /* 100% + bottom offset to fully hide below viewport */
    transition: transform 0.3s ease;
    z-index: 999;
    overflow-y: auto;
    padding: 0.5rem 1rem 1rem;
}

/* Drag handle */
.mobile-app-sheet-handle {
    width: 2rem;
    height: 0.25rem;
    background: var(--border-secondary, #ddd);
    border-radius: 0.125rem;
    margin: 0.5rem auto 1rem;
}

/* Group sections */
.mobile-app-sheet-group {
    margin-bottom: 1rem;
}

.mobile-app-sheet-group-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary, #999);
    padding: 0.25rem 0;
    margin-bottom: 0.5rem;
}

/* App items — vertical list */
.mobile-app-sheet-items {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.mobile-app-sheet-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.5rem;
    border-radius: 0.5rem;
    color: var(--text-primary, #333);
    text-decoration: none;
    font-size: 0.875rem;
    -webkit-tap-highlight-color: transparent;
}

.mobile-app-sheet-item:hover,
.mobile-app-sheet-item:active {
    background: var(--bg-hover, #f5f5f5);
}

.mobile-app-sheet-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    color: var(--text-secondary, #666);
}

.mobile-app-sheet-item-icon svg {
    width: 100%;
    height: 100%;
}

.mobile-app-sheet-item-label {
    font-weight: 500;
}

/* Show bottom nav and sheet on mobile */
@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
    }

    .mobile-app-sheet {
        display: block;
        /* starts off-screen via transform, slides up when .open */
    }

    .mobile-app-sheet-backdrop.open {
        display: block;
    }

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

    :root {
        --safe-bottom: 4rem;
    }
}
