/* ==========================================
   MOBILE NAVIGATION STYLES
   Phase 1: Mobile-friendly navigation shell
   ========================================== */

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
    display: none; /* Hidden by default, shown on mobile */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #1f2937;
    border-top: 1px solid #374151;
    z-index: 9999;
    padding-bottom: env(safe-area-inset-bottom, 0); /* iOS safe area */
}

.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
    min-height: 64px;
    -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item:active {
    background: rgba(59, 130, 246, 0.1);
}

.mobile-nav-item.active {
    color: #3b82f6;
}

.mobile-nav-item.active .mobile-nav-icon {
    color: #3b82f6;
}

.mobile-nav-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-nav-icon svg {
    width: 24px;
    height: 24px;
}

.mobile-nav-label {
    font-size: 10px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

/* Mobile Header */
.mobile-header {
    display: none; /* Hidden by default, shown on mobile */
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #1f2937;
    border-bottom: 1px solid #374151;
    z-index: 9998;
    padding: 0 12px;
    padding-top: env(safe-area-inset-top, 0); /* iOS safe area */
    align-items: center;
    justify-content: space-between;
}

.mobile-header-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mobile-status-dot.connected,
.mobile-status-dot.online {
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
}

.mobile-status-dot.disconnected {
    background: #ef4444;
    box-shadow: 0 0 6px #ef4444;
}

.mobile-status-dot.offline {
    background: #6b7280;
}

.mobile-header-signal {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
}

.mobile-header-signal-text {
    font-size: 11px;
    font-weight: 500;
}

.mobile-header-title {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-header-user {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.mobile-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #3b82f6;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

/* User Menu Overlay */
.mobile-user-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 60px 8px 0 8px;
    padding-top: calc(60px + env(safe-area-inset-top, 0));
}

.mobile-user-menu {
    background: #2a2a2a;
    border-radius: 12px;
    width: 260px;
    max-width: calc(100vw - 16px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.mobile-user-menu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #1f2937;
    border-bottom: 1px solid #374151;
}

.mobile-user-avatar-large {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #3b82f6;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    flex-shrink: 0;
}

.mobile-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.mobile-user-name {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-user-role {
    font-size: 12px;
    color: #9ca3af;
}

.mobile-user-menu-status {
    padding: 12px 16px;
    border-bottom: 1px solid #374151;
}

.mobile-status-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
    color: #d1d5db;
}

.mobile-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 16px;
    background: transparent;
    border: none;
    color: #ef4444;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.mobile-logout-btn:active {
    background: rgba(239, 68, 68, 0.1);
}

/* More Menu Overlay */
.mobile-more-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 64px; /* Above bottom nav */
    bottom: calc(64px + env(safe-area-inset-bottom, 0));
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.mobile-more-menu {
    background: #2a2a2a;
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4);
}

.mobile-more-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #374151;
    position: sticky;
    top: 0;
    background: #2a2a2a;
}

.mobile-more-header span {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
}

.mobile-more-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #374151;
    border: none;
    color: #9ca3af;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-more-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 16px;
}

.mobile-more-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 8px;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 12px;
    color: #d1d5db;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-more-item:active {
    background: #374151;
}

.mobile-more-item.active {
    background: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
    color: #3b82f6;
}

.mobile-more-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-more-icon svg {
    width: 28px;
    height: 28px;
}

.mobile-more-label {
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
}

/* ==========================================
   MOBILE LAYOUT ADJUSTMENTS
   ========================================== */

/* Show mobile components on phones */
@media (max-width: 767px) {
    .mobile-bottom-nav {
        display: flex;
    }
    
    .mobile-header {
        display: flex;
    }
    
    /* Hide desktop header on mobile */
    .desktop-header {
        display: none !important;
    }
    
    /* Add padding for fixed bottom nav */
    .mobile-main-content {
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0) + 16px);
        padding-top: 8px;
    }
    
    /* Adjust container padding */
    .container.mx-auto.px-4 {
        padding-left: 12px;
        padding-right: 12px;
    }
    
    /* Make cards touch-friendly */
    .card {
        min-height: auto;
        margin-bottom: 12px;
    }
    
    /* Ensure touch targets are at least 44px */
    button, 
    .tab-btn,
    [role="button"] {
        min-height: 44px;
    }
}

/* Tablet and up - show desktop layout */
@media (min-width: 768px) {
    .mobile-bottom-nav,
    .mobile-header,
    .mobile-user-menu-overlay,
    .mobile-more-overlay {
        display: none !important;
    }
    
    .desktop-header {
        display: block !important;
    }
}

/* ==========================================
   UTILITY CLASSES FOR MOBILE
   ========================================== */

.hide-on-mobile {
    display: block;
}

.show-on-mobile {
    display: none;
}

@media (max-width: 767px) {
    .hide-on-mobile {
        display: none !important;
    }
    
    .show-on-mobile {
        display: block !important;
    }
}

/* Safe area utilities */
.safe-area-top {
    padding-top: env(safe-area-inset-top, 0);
}

.safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Text utilities */
.text-green-400 { color: #4ade80; }
.text-blue-400 { color: #60a5fa; }
.text-red-400 { color: #f87171; }
.text-gray-400 { color: #9ca3af; }