/**
 * Navigation Component Styles
 * Global notifications, mobile navigation, FAB menu
 */

/* ==================== Global Notification System ==================== */
.global-notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

@media (max-width: 480px) {
    .global-notification-container {
        top: 70px;
        right: 12px;
        left: 12px;
        max-width: none;
    }
}

.global-notification {
    padding: 14px 18px;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: notificationSlideIn 0.3s ease;
    background: #fff;
    border-left: 4px solid #6366f1;
}

.global-notification.success {
    border-left-color: #10b981;
    background: linear-gradient(to right, rgba(16, 185, 129, 0.05), #fff);
}

.global-notification.error {
    border-left-color: #ef4444;
    background: linear-gradient(to right, rgba(239, 68, 68, 0.05), #fff);
}

.global-notification.warning {
    border-left-color: #f59e0b;
    background: linear-gradient(to right, rgba(245, 158, 11, 0.05), #fff);
}

.global-notification.info {
    border-left-color: #3b82f6;
    background: linear-gradient(to right, rgba(59, 130, 246, 0.05), #fff);
}

.global-notification-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.global-notification.success .global-notification-icon {
    background: #dcfce7;
    color: #10b981;
}

.global-notification.error .global-notification-icon {
    background: #fee2e2;
    color: #ef4444;
}

.global-notification.warning .global-notification-icon {
    background: #fef3c7;
    color: #f59e0b;
}

.global-notification.info .global-notification-icon {
    background: #dbeafe;
    color: #3b82f6;
}

.global-notification-content {
    flex: 1;
    font-size: 14px;
    color: #1f2937;
    font-weight: 500;
}

.global-notification-close {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    font-size: 16px;
    line-height: 1;
    transition: color 0.2s;
}

.global-notification-close:hover {
    color: #4b5563;
}

.global-notification.hiding {
    animation: notificationSlideOut 0.3s ease forwards;
}

@keyframes notificationSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes notificationSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* ==================== Prevent transitions on page load ==================== */
body.page-loading .app-sidebar,
body.page-loading .app-right-sidebar,
body.page-loading .app-main {
    transition: none !important;
}

/* ==================== Mobile Nav Chat Button (Center) ==================== */
.mobile-nav-chat {
    position: relative;
}

.mobile-nav-chat-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 2px solid rgba(99, 102, 241, 0.2);
}

.mobile-nav-chat-btn i,
.mobile-nav-chat-btn svg {
    font-size: 1.25rem;
    color: #ffffff !important;
}

.mobile-nav-chat:active .mobile-nav-chat-btn {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.mobile-nav-chat.active .mobile-nav-chat-btn {
    background: #f8fafc;
    border-color: rgba(99, 102, 241, 0.4);
}

/* ==================== Mobile Page Tabs (iOS Segmented Control) ==================== */
.mobile-page-tabs {
    position: fixed !important;
    top: 56px !important;
    left: 0 !important;
    right: 0 !important;
    background: #f8fafc !important;
    z-index: 99 !important;
    padding: 8px 16px 10px !important;
    display: none !important;
}

.mobile-page-tabs.visible {
    display: block !important;
}

.mobile-page-tabs-inner {
    display: flex !important;
    background: rgba(120, 120, 128, 0.12) !important;
    border-radius: 9px !important;
    padding: 2px !important;
}

.mobile-page-tab {
    flex: 1 !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #1c1c1e !important;
    text-decoration: none !important;
    text-align: center !important;
    border-radius: 7px !important;
    transition: all 0.15s ease !important;
    white-space: nowrap !important;
}

.mobile-page-tab.active {
    background: #ffffff !important;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.04) !important;
    color: #1c1c1e !important;
}

/* Desktop: hide tabs */
@media (min-width: 1024px) {
    .mobile-page-tabs,
    .mobile-page-tabs.visible {
        display: none !important;
    }
}

/* ==================== Mobile Header Styles ==================== */
.mobile-header-page-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.mobile-header-logo {
    display: none;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--color-text-primary);
}

.mobile-header-logo-text {
    font-weight: 700;
    font-size: 1.125rem;
}

.mobile-back-btn {
    text-decoration: none;
    color: var(--color-text-primary);
    display: none;
}

.mobile-header-profile {
    display: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
    color: #fff;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 14px;
}

#mobile-new-chat-btn {
    display: none;
}

/* Home page: show logo and profile, hide title */
body[data-page="dashboard"] .mobile-header-logo,
body[data-page="home"] .mobile-header-logo {
    display: flex !important;
}

body[data-page="dashboard"] .mobile-header-profile,
body[data-page="home"] .mobile-header-profile {
    display: flex !important;
}

body[data-page="dashboard"] .mobile-header-page-title,
body[data-page="home"] .mobile-header-page-title {
    display: none !important;
}

/* Mobile: show header on all pages */
@media (max-width: 1023px) {
    #mobile-header {
        display: flex !important;
    }
    
    /* Hide page h1 titles on mobile - they're in header now */
    .mobile-hide-title {
        display: none !important;
        margin: 0 !important;
        padding: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
    }
    
    /* When page has tabs, add extra margin for tabs bar */
    body.has-page-tabs .app-mobile-content {
        margin-top: 100px !important;
    }
}

/* Desktop: hide header */
@media (min-width: 1024px) {
    #mobile-header {
        display: none !important;
    }
}

/* Chat mode: show back button and new chat */
body.chat-mode-active .mobile-back-btn {
    display: flex !important;
}

body.chat-mode-active #mobile-new-chat-btn {
    display: flex !important;
}

/* ==================== Mobile FAB (Floating Action Button) ==================== */
.mobile-fab-container {
    display: none;
    position: fixed;
    bottom: 88px;
    right: 16px;
    z-index: 1000;
}

@media (max-width: 1023px) {
    .mobile-fab-container {
        display: block;
    }
    
    /* Hide FAB when in chat mode */
    body.chat-mode-active .mobile-fab-container {
        display: none;
    }
}

.mobile-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.mobile-fab:active {
    transform: scale(0.95);
}

.mobile-fab.active {
    transform: rotate(45deg);
    background: #4f46e5;
}

.mobile-fab-menu {
    position: absolute;
    bottom: 64px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
}

.mobile-fab-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mobile-fab-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
    transition: background 0.15s;
}

.mobile-fab-item:active {
    background: #f3f4f6;
}

.mobile-fab-item i {
    width: 20px;
    text-align: center;
    color: #6366f1;
}

/* FAB backdrop when menu is open */
.mobile-fab-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s;
}

.mobile-fab-backdrop.show {
    opacity: 1;
    visibility: visible;
}
