/* Bottom Navigation Styles for Public Pages (Android Only) */
/* Enhanced with safe area insets, improved styling, and better touch targets */

/* ============================================
   1. SAFE AREA INSETS
   For notches, gesture bars, and rounded corners
   ============================================ */

body.is-android {
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* ============================================
   2. BOTTOM NAVIGATION
   ============================================ */

#bottom-nav {
    display: none; /* Hidden on web */
}

body.is-android #bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    height: calc(64px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    will-change: transform;
    transform: translateY(0);
    transition: transform 0.3s ease;
}

/* Hidden state when scrolling down */
body.is-android #bottom-nav.nav-hidden {
    transform: translateY(100%);
}

body.is-android.dark #bottom-nav {
    background: #1f2937;
    border-top-color: #374151;
}

/* Add bottom padding to content for nav clearance on Android */
body.is-android main,
body.is-android .main-content,
body.is-android article {
    padding-bottom: calc(80px + env(safe-area-inset-bottom)) !important;
}

/* Bottom nav items */
.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
    padding: 8px;
    min-height: 48px;
    min-width: 48px;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item:active {
    background: rgba(16, 185, 129, 0.1);
}

body.is-android.dark .bottom-nav-item {
    color: #9ca3af;
}

body.is-android.dark .bottom-nav-item:active {
    background: rgba(52, 211, 153, 0.1);
}

.bottom-nav-item svg,
.bottom-nav-item i {
    width: 24px;
    height: 24px;
}

.bottom-nav-item span {
    font-size: 11px;
    font-weight: 500;
}

.bottom-nav-item.active {
    color: #10b981;
}

body.is-android.dark .bottom-nav-item.active {
    color: #34d399;
}

/* ============================================
   3. MENU DRAWER
   ============================================ */

#menu-drawer-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

#menu-drawer-backdrop.open {
    display: block;
    opacity: 1;
}

#menu-drawer {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100%;
    background: white;
    z-index: 2001;
    transition: right 0.3s ease;
    overflow-y: auto;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    will-change: transform;
    padding-top: env(safe-area-inset-top);
    display: flex;
    flex-direction: column;
}

body.dark #menu-drawer {
    background: #1f2937;
}

#menu-drawer.open {
    right: 0;
}

/* Drawer Header - Brand styling */
.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

body.dark .drawer-header {
    border-bottom-color: #374151;
}

.drawer-header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.drawer-logo {
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

.drawer-title {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
}

body.dark .drawer-title {
    color: #f9fafb;
}

.drawer-close-btn {
    padding: 8px;
    border-radius: 9999px;
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    transition: background 0.2s ease;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.drawer-close-btn:active {
    background: #f3f4f6;
}

body.dark .drawer-close-btn {
    color: #9ca3af;
}

body.dark .drawer-close-btn:active {
    background: #374151;
}

/* Drawer Content */
.drawer-section {
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
}

body.dark .drawer-section {
    border-bottom-color: #374151;
}

.drawer-section:last-of-type {
    border-bottom: none;
}

.drawer-section-title {
    padding: 8px 20px;
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

body.dark .drawer-section-title {
    color: #6b7280;
}

.drawer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: #374151;
    text-decoration: none;
    transition: background 0.2s ease;
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 15px;
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
}

body.dark .drawer-item {
    color: #e5e7eb;
}

.drawer-item:active {
    background: #f3f4f6;
}

body.dark .drawer-item:active {
    background: #374151;
}

.drawer-item svg,
.drawer-item i {
    width: 20px;
    height: 20px;
    color: #6b7280;
    flex-shrink: 0;
}

body.dark .drawer-item svg,
body.dark .drawer-item i {
    color: #9ca3af;
}

/* Drawer Footer */
.drawer-footer {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

body.dark .drawer-footer {
    border-top-color: #374151;
}

.drawer-footer span {
    font-size: 12px;
    color: #9ca3af;
}

body.dark .drawer-footer span {
    color: #6b7280;
}

/* ============================================
   4. TOUCH OPTIMIZATIONS
   ============================================ */

body.is-android button,
body.is-android a,
body.is-android .clickable {
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}

body.is-android .overflow-y-auto {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Passive touch scrolling hint */
body.is-android * {
    touch-action: manipulation;
}

/* ============================================
   5. PERFORMANCE OPTIMIZATIONS
   ============================================ */

body.is-android #bottom-nav,
body.is-android #menu-drawer {
    will-change: transform, opacity;
}

/* Hardware acceleration for animations */
body.is-android .animate-transition {
    transform: translateZ(0);
    backface-visibility: hidden;
}
