/* Site portal header — desktop */

@media (min-width: 769px) {
    .site-header.h5-header {
        display: none;
    }

    .site-portal-header {
        display: block;
    }
}

@media (max-width: 768px) {
    .site-portal-header {
        display: none;
    }
}

.site-portal-header {
    position: relative;
    z-index: 120;
    background: #fff;
}

/* Top utility bar */
.portal-topbar {
    background: #1f2937;
    color: #9ca3af;
    font-size: 0.76rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.portal-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 34px;
}

.portal-topbar-left,
.portal-topbar-right {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.portal-topbar-welcome {
    color: #d1d5db;
}

.portal-topbar a {
    color: #9ca3af;
    transition: color 0.15s;
}

.portal-topbar a:hover {
    color: #fff;
}

.portal-topbar-contact {
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    color: inherit;
}

.portal-topbar-contact:hover {
    color: #fff;
}

.portal-topbar-accent,
.portal-topbar-user {
    color: #fbbf24 !important;
}

.portal-topbar-accent:hover,
.portal-topbar-user:hover {
    color: #fde68a !important;
}

.portal-topbar-divider {
    color: #4b5563;
    user-select: none;
}

/* Sticky search + nav */
.portal-sticky-bar {
    position: sticky;
    top: 0;
    z-index: 110;
    background: #fff;
    box-shadow: 0 1px 0 #e5e7eb;
    transition: box-shadow 0.2s;
}

.site-portal-header.is-scrolled .portal-sticky-bar {
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.1);
}

.portal-searchbar {
    padding: 16px 0 12px;
    background: #fff;
}

.portal-searchbar-inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 28px;
}

.portal-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    color: inherit;
}

.portal-logo:hover {
    color: inherit;
    opacity: 0.92;
}

.portal-logo-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    font-size: 1.6rem;
    box-shadow: inset 0 0 0 1px #bfdbfe;
}

.portal-logo-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.portal-logo-text strong {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.2;
    color: #1d4ed8;
    letter-spacing: 0.01em;
}

.portal-logo-text small {
    font-size: 0.72rem;
    color: #94a3b8;
    line-height: 1.3;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-search-wrap {
    min-width: 0;
}

.portal-search-form {
    display: flex;
    align-items: stretch;
    height: 44px;
    border: 2px solid #2563eb;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.portal-search-form:focus-within {
    border-color: #1d4ed8;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.portal-search-icon {
    display: flex;
    align-items: center;
    padding: 0 4px 0 14px;
    font-size: 0.95rem;
    opacity: 0.45;
    user-select: none;
}

.portal-search-form input {
    flex: 1;
    min-width: 0;
    border: none;
    padding: 0 8px;
    font-size: 0.92rem;
    outline: none;
    background: transparent;
}

.portal-search-form button {
    flex-shrink: 0;
    min-width: 88px;
    padding: 0 20px;
    border: none;
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.portal-search-form button:hover {
    background: #1d4ed8;
}

.portal-hot-keywords {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    margin-top: 8px;
    font-size: 0.76rem;
}

.portal-hot-keywords > span {
    flex-shrink: 0;
    padding: 1px 7px;
    border-radius: 3px;
    background: #f1f5f9;
    color: #64748b;
    font-weight: 600;
}

.portal-hot-keywords a {
    color: #16a34a;
}

.portal-hot-keywords a:hover {
    color: #15803d;
    text-decoration: underline;
}

.portal-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.portal-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #334155 !important;
    font-size: 0.86rem;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.15s;
}

.portal-action-btn:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.portal-action-primary {
    border-color: #2563eb;
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.portal-action-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff !important;
}

.portal-action-btn [data-member-name] {
    max-width: 96px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portal-action-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
}

/* Main navigation */
.portal-main-nav {
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.portal-main-nav-inner {
    display: flex;
    align-items: stretch;
    gap: 0;
    min-height: 44px;
}

.portal-nav-group {
    display: flex;
    align-items: stretch;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.portal-nav-group::-webkit-scrollbar {
    display: none;
}

.portal-nav-split {
    width: 1px;
    margin: 8px 6px;
    background: rgba(255, 255, 255, 0.22);
    flex-shrink: 0;
}

.portal-nav-link {
    display: inline-flex;
    align-items: center;
    padding: 0 16px;
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.88rem;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.portal-nav-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.portal-nav-link.active {
    background: rgba(255, 255, 255, 0.18);
    color: #fef08a;
    font-weight: 700;
    box-shadow: inset 0 -3px 0 #fef08a;
}

.portal-nav-cat {
    font-size: 0.84rem;
    color: rgba(255, 255, 255, 0.82);
}

.portal-nav-primary {
    flex-shrink: 0;
}

.portal-nav-cats {
    flex: 1;
    min-width: 0;
}

@media (max-width: 1100px) {
    .portal-searchbar-inner {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 16px;
    }

    .portal-header-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }

    .portal-logo-text small {
        display: none;
    }
}

@media (max-width: 900px) {
    .portal-topbar-welcome {
        display: none;
    }
}
