/**
 * Mobile Navigation Styles
 * Responsive navigation for all screen sizes
 */

/* Bottom navigation for chat page */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-card, #ffffff);
    border-top: 1px solid var(--border-color, #e5e7eb);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.mobile-nav-item {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 8px;
    position: relative;
}

.mobile-nav-item:hover {
    background: var(--hover-overlay, rgba(0, 0, 0, 0.05));
}

.mobile-nav-item--active {
    color: var(--primary, #2563eb);
}

.mobile-nav-item--active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--primary, #2563eb);
}

.mobile-nav-item svg {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
}

.mobile-nav-item span {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Ensure chat container accounts for bottom nav on mobile */
@media (max-width: 768px) {
    .chat-container {
        padding-bottom: 60px;
    }
    
    /* Show mobile nav only on mobile */
    .mobile-nav {
        display: flex;
    }
}

/* Hide mobile nav on desktop */
@media (min-width: 769px) {
    .mobile-nav {
        display: none;
    }
}

/* Mobile Navigation Toggle */
.mobile-nav-toggle {
    display: none;
    position: relative;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: var(--hover-overlay);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    z-index: 1001;
    transition: background 0.3s ease;
}

.mobile-nav-toggle:hover {
    background: var(--hover-overlay);
}

.hamburger {
    display: block;
    position: relative;
    width: 24px;
    height: 20px;
}

.hamburger span {
    display: block;
    position: absolute;
    width: 100%;
    height: 3px;
    background-color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.hamburger span:nth-child(1) {
    top: 0;
}

.hamburger span:nth-child(2) {
    top: 50%;
    transform: translateY(-50%);
}

.hamburger span:nth-child(3) {
    bottom: 0;
}

/* Active state */
.mobile-nav-toggle.active .hamburger span:nth-child(1) {
    transform: rotate(45deg);
    top: 50%;
    transform-origin: center;
}

.mobile-nav-toggle.active .hamburger span:nth-child(2) {
    opacity: 0;
}

.mobile-nav-toggle.active .hamburger span:nth-child(3) {
    transform: rotate(-45deg);
    bottom: 50%;
    transform-origin: center;
}

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
    transition: right 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.mobile-menu.open {
    right: 0;
}

/* Mobile Menu Close Button */
.mobile-menu-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-color);
    z-index: 1;
}

/* Mobile Menu Content */
.mobile-nav-items {
    display: flex;
    flex-direction: column;
    padding: 80px 20px 20px;
    gap: 0;
}

.mobile-nav-items .nav-link {
    display: block;
    padding: 15px 20px;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid var(--border-default);
    transition: all 0.2s ease;
}

.mobile-nav-items .nav-link:hover,
.mobile-nav-items .nav-link.active {
    background-color: var(--bg-color);
    color: var(--primary-color);
    padding-left: 30px;
}

/* Mobile Nav Actions */
.mobile-nav-actions {
    padding: 20px;
    margin-top: auto;
    border-top: 1px solid var(--border-default);
}

.mobile-nav-actions .language-selector {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Theme toggle in mobile menu */
.mobile-nav-actions #theme-toggle-container {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.mobile-nav-actions .btn {
    width: 100%;
    justify-content: center;
}

/* Admin dropdown in mobile */
.mobile-nav-items .nav-dropdown {
    position: relative;
}

.mobile-nav-items .dropdown-menu {
    position: static;
    display: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    background: var(--bg-color);
    margin: 0;
    width: 100%;
    padding: 0;
}

.mobile-nav-items .nav-dropdown.show .dropdown-menu {
    display: block;
}

.mobile-nav-items .dropdown-menu .dropdown-item {
    padding: 12px 40px;
    border-bottom: 1px solid var(--border-default);
}

/* Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-dark);
    display: none;
    z-index: 999;
}

.mobile-menu-overlay.show {
    display: block;
}

/* Desktop adjustments */
@media (min-width: 969px) {
    .mobile-nav-toggle,
    .mobile-menu,
    .mobile-menu-overlay {
        display: none !important;
    }
}

/* Mobile adjustments */
@media (max-width: 968px) {
    /* Show mobile nav */
    .mobile-nav-toggle {
        display: block;
    }
    
    /* Hide desktop nav items */
    .nav-menu {
        display: none;
    }
    
    /* Adjust navbar layout */
    .navbar .container,
    .nav-container {
        padding: 0.75rem 1rem;
    }
    
    /* Adjust nav brand */
    .nav-brand h1,
    .nav-brand .tenant-name {
        font-size: 1.25rem;
    }
    
    /* User avatar visible on mobile */
    .user-avatar-container {
        display: flex !important;
        position: relative;
        margin-right: 60px; /* Space for hamburger */
        z-index: 1002;
    }
    
    /* Hide other nav actions on mobile but keep theme toggle visible */
    .nav-actions {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-right: 60px; /* Space for hamburger */
    }
    
    /* Keep theme toggle visible on mobile */
    #theme-toggle-container {
        display: flex !important;
    }
}

/* Small mobile adjustments */
@media (max-width: 480px) {
    .mobile-menu {
        width: 90%;
    }
    
    .nav-brand h1,
    .nav-brand .tenant-name {
        font-size: 1.1rem;
    }
    
    .mobile-nav-items .nav-link {
        padding: 12px 15px;
    }
}

/* Ensure proper stacking */
body.mobile-menu-open {
    overflow: hidden;
}

/* Touch-friendly sizes */
@media (max-width: 968px) {
    .btn,
    button,
    .nav-link,
    .dropdown-item {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* Landscape mobile adjustments */
@media (max-width: 968px) and (orientation: landscape) {
    .mobile-menu {
        padding-top: 10px;
    }
    
    .mobile-nav-items {
        padding-top: 60px;
    }
    
    .mobile-nav-items .nav-link {
        padding: 10px 15px;
    }
}