/* 
 * HUB ESTILOS (Global Navigation 2.0)
 * Glassmorphism, UI Premium, Mobile Responsive
 */

/* =========================================
   1. HAMBURGER MENU BUTTON
   ========================================= */
.hub-menu-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    flex-shrink: 0;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    background: rgba(15, 23, 42, 0.05);
    /* very subtle dark box */
    margin-right: 15px;
    /* space between it and the logo */
    z-index: 1000;
    position: relative;
}

.hub-menu-btn:hover {
    background: rgba(37, 99, 235, 0.1);
}

.hub-menu-btn span {
    display: block;
    width: 24px;
    height: 2.5px;
    background-color: #1e293b;
    border-radius: 4px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    transform-origin: left center;
}

/* Appears exactly in the sidebar header top row */
.header-top-row.v2-flex {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 25px;
}

/* =========================================
   2. GLOBAL HUB MODAL (Overlay Desktop)
   ========================================= */
.global-hub-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.85);
    /* Dark Glass */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 100000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.global-hub-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.global-hub-container {
    width: 100%;
    max-width: 850px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 32px;
    padding: 50px;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5);
    color: white;
    transform: scale(0.95) translateY(20px);
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    position: relative;
    display: flex;
    flex-direction: column;
}

.global-hub-overlay.active .global-hub-container {
    transform: scale(1) translateY(0);
}

/* Close Button in Hub */
.hub-close-btn {
    position: absolute;
    top: 30px;
    right: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.hub-close-btn:hover {
    background: #ef4444;
    transform: rotate(90deg);
}

/* =========================================
   3. APP GRID (The "Apps")
   ========================================= */
.hub-apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.hub-app-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 25px 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-decoration: none;
    color: inherit;
}

.hub-app-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.hub-app-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin-bottom: 15px;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

.hub-app-title {
    font-size: 13px;
    font-weight: 700;
    color: #cbd5e1;
    letter-spacing: 0.3px;
}

/* Specific App Colors */
.app-crm .hub-app-icon {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.app-wallet .hub-app-icon {
    background: linear-gradient(135deg, #10b981, #047857);
}

.app-radar .hub-app-icon {
    background: linear-gradient(135deg, #f59e0b, #b45309);
}

.app-analytics .hub-app-icon {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
}

.app-support .hub-app-icon {
    background: linear-gradient(135deg, #64748b, #334155);
}

.app-admin .hub-app-icon {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
}

/* =========================================
   4. USER PROFILE BANNER IN HUB
   ========================================= */
.hub-profile-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(15, 23, 42, 0.4));
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 20px;
}

.hub-user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.hub-user-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #94a3b8;
    border: 3px solid rgba(255, 255, 255, 0.1);
}

.hub-user-details h3 {
    margin: 0 0 5px 0;
    font-size: 20px;
    font-weight: 800;
}

.hub-user-details p {
    margin: 0;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 500;
}

.hub-premium-badge {
    background: linear-gradient(90deg, #f59e0b, #d97706);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
}

.hub-credits-display {
    text-align: right;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.2);
    padding: 15px 20px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
}

.hub-credits-display:hover {
    background: rgba(255, 255, 255, 0.05);
}

.hub-credits-title {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.hub-credits-value {
    font-size: 24px;
    font-weight: 900;
    color: #fbbf24;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =========================================
   5. HUB FOOTER (Logout / Notifications)
   ========================================= */
.hub-footer {
    margin-top: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hub-footer-btn {
    background: transparent;
    color: #94a3b8;
    border: none;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: color 0.2s;
    padding: 10px;
    border-radius: 10px;
}

.hub-footer-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.hub-footer-btn.logout:hover {
    color: #ef4444;
}

/* Badges for footer */
.hub-notif-badge {
    background: #ef4444;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 800;
    display: none;
}

/* =========================================
   6. RESPONSIVE MODAL FOR APPS (CRM, Wallet)
   ========================================= */
.app-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.85);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.app-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.app-modal-content {
    background: white;
    /* Keep white for familiar CRM/Wallet looks or dark if preferred */
    width: 100%;
    max-width: 900px;
    height: 85vh;
    /* Large inner app */
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(30px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

.app-modal.active .app-modal-content {
    transform: translateY(0);
}

.app-modal-header {
    background: #f8fafc;
    padding: 20px 30px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    background: #ffffff;
}

.app-modal-close {
    background: #e2e8f0;
    color: #64748b;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
}

.app-modal-close:hover {
    background: #cbd5e1;
    color: #0f172a;
}

/* =========================================
   7. SIDEBAR 2.0 (Search Engine specific)
   ========================================= */
/* Sidebar is now purely for search. */
#sidebar {
    /* Existing constraints mostly fine, overriding some margins */
    display: flex;
    flex-direction: column;
}

#searchResults {
    flex: 1;
    overflow-y: auto;
    padding: 10px 5px;
    margin-top: 15px;
    /* Added spacing from filters */
}

/* Modern Card for Search Results */
.modern-search-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    gap: 15px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.modern-search-card:hover {
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.1);
}

/* Card Info Layout */
.msc-icon {
    width: 48px;
    height: 48px;
    background: #f1f5f9;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #64748b;
    flex-shrink: 0;
}

.modern-search-card:hover .msc-icon {
    background: #eff6ff;
    color: #2563eb;
}

.msc-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.msc-title {
    font-size: 14px;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 4px;
}

.msc-subtitle {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

.msc-badge {
    background: #f1f5f9;
    color: #475569;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    display: inline-block;
    margin-top: 6px;
}

/* =========================================
   8. MOBILE RESPONSIVENESS
   ========================================= */
@media (max-width: 768px) {

    /* Sidebar as bottom sheet */
    #sidebar {
        border-right: none;
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
        max-height: 80vh;
        /* Don't cover entire map */
        transform: translateY(calc(100% - 140px));
        /* Peak mode */
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 5000;
        padding-top: 15px;
        /* Handle area */
    }

    /* Sliding Handle purely for mobile */
    #sidebar::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 5px;
        background: #cbd5e1;
        border-radius: 3px;
    }

    #sidebar.mobile-open {
        transform: translateY(0);
    }

    /* Global Hub Mobile Adjustments */
    .global-hub-container {
        border-radius: 0;
        height: 100vh;
        padding: 30px 20px;
        transform: translateY(100%);
    }

    .global-hub-overlay.active .global-hub-container {
        transform: translateY(0);
    }

    .hub-profile-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .hub-credits-display {
        text-align: left;
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .hub-credits-value {
        margin: 0;
    }

    /* App Modals Mobile */
    .app-modal-content {
        height: 100vh;
        border-radius: 0;
        transform: translateY(100%);
    }
}
@keyframes pulse-menu-btn {
  0% { box-shadow: 0 0 0 0 rgba(109, 40, 217, 0.7); }
  70% { box-shadow: 0 0 0 12px rgba(109, 40, 217, 0); }
  100% { box-shadow: 0 0 0 0 rgba(109, 40, 217, 0); }
}
.hub-menu-btn.pulse-active { animation: pulse-menu-btn 2s infinite; }

