/* Header — glass + subtle elevation */
.header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255,255,255,.92);
    backdrop-filter: saturate(1.2) blur(8px);
    -webkit-backdrop-filter: saturate(1.2) blur(8px);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 1px 8px rgba(0,0,0,.04);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

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

.header-logo-text .kilus {
    color: var(--color-text-primary);
}

.header-logo-text .ph {
    color: var(--color-brand);
}

.header-tagline {
    display: none;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Brand image logos (white-background PNG lockups): rounded so they sit
   cleanly on any header surface. Height-constrained; width auto. */
.header-logo-img {
    height: 40px;
    width: auto;
    border-radius: 8px;
    display: block;
}
.mobile-nav-logo-img,
.footer-logo-img {
    height: 32px;
    width: auto;
    border-radius: 6px;
    display: block;
}
.tv-logo-img {
    height: 44px;
    width: auto;
    border-radius: 8px;
}

@media (min-width: 640px) {
    .header-tagline {
        display: block;
    }
}

.header-search {
    flex: 1;
    max-width: 32rem;
    margin: 0 var(--space-lg);
    position: relative;
    display: flex;
    align-items: center;
}

@media (max-width: 768px) {
    .header-search {
        display: none;
    }
}

.header-search input {
    width: 100%;
    padding: var(--space-sm) 2.5rem var(--space-sm) 2.5rem;
    background-color: var(--color-surface-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.header-search input:focus {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px var(--color-focus-ring);
    background: #fff;
}

.header-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    color: var(--color-text-muted);
    pointer-events: none;
}

.search-deep-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: color 0.2s, background 0.2s;
    z-index: 1;
}

.search-deep-btn:hover {
    color: var(--color-brand);
    background: var(--color-bg-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.header-btn-login {
    display: none;
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    transition: color 0.2s;
}

.header-btn-login:hover {
    color: var(--color-text-primary);
}

@media (min-width: 640px) {
    .header-btn-login {
        display: block;
    }
}

.header-btn-signup {
    display: none;
    padding: var(--space-sm) var(--space-md);
    background-color: var(--color-brand);
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: background-color 0.2s;
}

.header-btn-signup:hover {
    background-color: var(--color-brand-hover);
}

@media (min-width: 640px) {
    .header-btn-signup {
        display: block;
    }
}

.header-notification {
    position: relative;
    padding: var(--space-sm);
    color: var(--color-text-secondary);
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.header-notification:hover {
    color: var(--color-text-primary);
}

.notification-wrapper {
    position: relative;
}

.header-notification-count {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 1.25rem;
    height: 1.25rem;
    background-color: var(--color-brand);
    color: white;
    font-size: 0.625rem;
    font-weight: 600;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

.header-notification-count[data-count="0"] {
    display: none;
}

.header-menu {
    padding: var(--space-sm);
    color: var(--color-text-secondary);
    transition: color 0.2s;
}

@media (min-width: 1024px) {
    .header-menu {
        display: none;
    }
}

/* Navigation */
.nav-bar {
    border-top: 1px solid var(--color-border);
}

@media (max-width: 1023px) {
    .nav-bar {
        display: none;
    }
}

.nav-bar-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: var(--space-xs) var(--space-md);
}

.nav-link {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    border-radius: var(--radius-md);
    transition: color 0.2s, background-color 0.2s;
    border-bottom: 2px solid transparent;
}

.nav-link:hover {
    color: var(--color-text-primary);
    background-color: var(--color-surface-secondary);
}

.nav-link.active {
    color: var(--color-brand);
    border-bottom-color: var(--color-brand);
}

[data-panel] {
    cursor: pointer;
}

/* ===== Nav Dropdown ===== */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-trigger {
    background: none;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    transition: color 0.2s, background-color 0.2s;
    border-bottom: 2px solid transparent;
    font-family: inherit;
    line-height: 1.5;
}

.nav-dropdown-trigger:hover {
    color: var(--color-text-primary);
    background-color: var(--color-surface-secondary);
}

.nav-dropdown-menu {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 180px;
    z-index: 60;
    padding: var(--space-xs) 0;
}

.nav-dropdown:hover .nav-dropdown-menu {
    display: block !important;
}

.nav-dropdown-item {
    display: block;
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
    color: var(--color-text-primary);
    text-decoration: none;
    transition: background-color 0.15s;
}

.nav-dropdown-item:hover {
    background-color: var(--color-surface-secondary);
}

/* Page Layout */
.page-layout {
    display: flex;
    min-height: calc(100vh - 120px);
}

.sidebar-left {
    display: none;
    width: 16rem;
    flex-shrink: 0;
}

@media (min-width: 1024px) {
    .sidebar-left {
        display: block;
    }
}

.sidebar-left-inner {
    position: sticky;
    top: 120px;
    height: calc(100vh - 120px);
    overflow-y: auto;
    padding: var(--space-md);
}

.main-content {
    flex: 1;
    min-width: 0;
    padding: var(--space-md);
    max-width: 56rem;
    margin: 0 auto;
}

.sidebar-right {
    display: none;
    width: 20rem;
    flex-shrink: 0;
}

@media (min-width: 1280px) {
    .sidebar-right {
        display: block;
    }
}

.sidebar-right-inner {
    position: sticky;
    top: 120px;
    height: calc(100vh - 120px);
    overflow-y: auto;
    padding: var(--space-md);
}

/* ===== Panel Transitions ===== */
.content-panel {
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.content-panel.panel-active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.content-panel.panel-exit {
    opacity: 0;
    transform: translateY(-10px);
}

.content-panel.panel-enter {
    opacity: 0;
    transform: translateY(10px);
}

/* ===== Full-page enter (same feel as panel switches) ===== */
@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-enter {
    animation: pageEnter 0.3s ease;
}

/* ===== Seamless feed swaps =====
   Filter/sort/category changes re-render feed HTML in place (no reload).
   Animate new items with the same fade+slide as panel switches. */
.pub-feed > *, .reports-feed > *, .freedom-wall-posts > *,
.kilosph-tv-videos > *, .pub-preview-feed > *, .discussions-feed > *,
.trending-list > *, .platform-impact-grid > *, .deep-search-results > * {
    animation: pageEnter 0.3s ease;
}

@media (prefers-reduced-motion: reduce) {
    .page-enter,
    .pub-feed > *, .reports-feed > *, .freedom-wall-posts > *,
    .kilosph-tv-videos > *, .pub-preview-feed > *, .discussions-feed > *,
    .trending-list > *, .platform-impact-grid > *, .deep-search-results > * {
        animation: none;
    }
}

/* ===== Nav Indicator ===== */
.nav-bar-inner {
    position: relative;
}

.nav-indicator {
    position: absolute;
    bottom: 0;
    height: 3px;
    background: var(--color-brand);
    border-radius: 3px 3px 0 0;
    transition: left 0.3s ease, width 0.3s ease;
}

.nav-link {
    position: relative;
    z-index: 1;
}

/* ===== Panel Header ===== */
.panel-header {
    margin-bottom: var(--space-xl);
}

.panel-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 var(--space-xs);
}

.panel-header p {
    color: var(--color-text-muted);
    margin: 0 0 var(--space-lg);
}

/* ===== Loading & Empty States ===== */
.loading-state, .empty-state {
    text-align: center;
    padding: var(--space-xl);
    color: var(--color-text-muted);
}

/* ===== Report Card Animations ===== */
.report-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.report-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ===== Sidebar Link Active State ===== */
.sidebar-nav-link.active {
    background: var(--color-bg-secondary);
    color: var(--color-brand);
    font-weight: 600;
}

.sidebar-nav-link.active .sidebar-nav-icon {
    color: var(--color-brand);
}
