/* ============================================================
   assets/css/header.css
   Antigravity-inspired header with mega-dropdown panels
   ============================================================ */

/* ── Variables ───────────────────────────────────────────── */
:root {
  --header-h: 60px;
  --mega-bg: rgba(18, 18, 32, 0.97);
  --mega-border: rgba(255,255,255,0.06);
  --mega-text: #c8c8d0;
  --mega-text-muted: #8888a0;
  --mega-hover: rgba(255,255,255,0.05);
}

/* ── Header shell ────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: linear-gradient(135deg, var(--header-start, #111122), var(--header-end, #16213e));
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              opacity  0.5s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 1;
  transform: translateY(0);
}

/* animated hide on scroll */
.site-header.header-hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

/* subtle shadow after scrolling */
.site-header.is-scrolled {
  box-shadow: 0 2px 16px rgba(0,0,0,0.35);
}

/* ── Inner bar (fixed height strip) ──────────────────────── */
.header-inner {
  height: var(--header-h);
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Brand / logo ────────────────────────────────────────── */
.header-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  flex-shrink: 0;
}
.brand-logo {
  height: 24px;
}
.brand-name {
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

/* ── Navigation links ────────────────────────────────────── */
.header-nav {
  display: flex;
  align-items: center;
  gap: 0;
  margin-left: 1.5rem;
}
.header-nav-link {
  color: var(--mega-text);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
  position: relative;
}
.header-nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.07);
}
.header-nav-link.active {
  color: #fff;
}
.header-nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0.6rem;
  right: 0.6rem;
  height: 2px;
  background: var(--bs-primary, #4f8cff);
  border-radius: 1px;
}

/* ── Right actions container ─────────────────────────────── */
.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* ── Circular icon buttons ───────────────────────────────── */
.header-icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.07);
  color: var(--mega-text);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  position: relative;
  padding: 0;
}
.header-icon-btn:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

/* ── Auth buttons match icon-btn height ──────────────────── */
.header-actions .btn-kt-outline,
.header-actions .btn-kt-primary {
  height: 32px;
  padding: 0 0.75rem;
  font-size: 0.78rem;
  border-radius: 6px;
  line-height: 1;
}

/* Badge on bell */
.header-badge {
  position: absolute;
  top: -3px;
  right: -4px;
  font-size: 0.58rem;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 8px;
  font-weight: 700;
  background: var(--bs-danger, #dc3545);
  color: #fff;
}

/* ── Avatar / profile trigger ────────────────────────────── */
.header-avatar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  padding: 0.15rem 0.45rem 0.15rem 0.15rem;
  border-radius: 20px;
  transition: background 0.2s;
}
.header-avatar:hover {
  background: rgba(255,255,255,0.08);
}
.avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  color: #fff;
}
.avatar-name {
  color: #e0e0e0;
  font-size: 0.8rem;
  font-weight: 500;
}
.avatar-chevron {
  font-size: 0.55rem;
  color: #888;
  transition: transform 0.25s;
}

/* rotate chevron when panel is open */
.header-mega-trigger.open .avatar-chevron {
  transform: rotate(180deg);
}

/* ── Mega dropdown trigger wrapper ───────────────────────── */
.header-mega-trigger {
  position: static;  /* panels are positioned relative to header */
}

/* ═══════════════════════════════════════════════════════════
   MEGA PANELS – full-width drop-down panels
   ═══════════════════════════════════════════════════════════ */
.mega-panel {
  position: absolute;
  top: var(--header-h);
  left: 0;
  right: 0;
  background: var(--mega-bg);
  border-bottom: 1px solid var(--mega-border);
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
  overflow: hidden;
  /* animated slide-down */
  max-height: 0;
  opacity: 0;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              opacity   0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 1029;
}
.mega-panel.open {
  max-height: 400px;
  opacity: 1;
  pointer-events: auto;
}

.mega-panel-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  gap: 2rem;
}

/* Left description column */
.mega-col--desc {
  flex: 0 0 200px;
}
.mega-title {
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.mega-desc {
  color: var(--mega-text-muted);
  font-size: 0.78rem;
  line-height: 1.5;
  margin-bottom: 0.8rem;
}
.mega-cta {
  display: inline-block;
  color: var(--bs-primary, #4f8cff);
  font-size: 0.78rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s;
  margin-right: 1rem;
}
.mega-cta:hover {
  color: #8bb8ff;
}
.mega-cta--danger {
  color: #f87171;
}
.mega-cta--danger:hover {
  color: #fca5a5;
}

/* Right content column */
.mega-col--content {
  flex: 1;
  display: flex;
  gap: 1.5rem;
}

.mega-section {
  flex: 1;
  min-width: 0;
}
.mega-section-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mega-text-muted);
  margin-bottom: 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--mega-border);
}

.mega-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 0.5rem;
  margin: 0.05rem 0;
  border-radius: 5px;
  color: var(--mega-text);
  text-decoration: none;
  font-size: 0.78rem;
  transition: background 0.15s, color 0.15s;
  gap: 0.4rem;
}
.mega-item:hover {
  background: var(--mega-hover);
  color: #fff;
}
.mega-item.unread {
  color: #fff;
  font-weight: 500;
}
.mega-item.unread::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bs-primary, #4f8cff);
  flex-shrink: 0;
}
.mega-item--danger {
  color: #f87171;
}
.mega-item--danger:hover {
  background: rgba(248,113,113,0.08);
  color: #fca5a5;
}

.mega-item-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mega-item-time,
.mega-item-meta {
  font-size: 0.7rem;
  color: var(--mega-text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

.mega-empty {
  font-size: 0.78rem;
  color: var(--mega-text-muted);
  padding: 0.3rem 0.6rem;
  margin: 0;
}

.mega-divider {
  height: 1px;
  background: var(--mega-border);
  margin: 0.5rem 0;
}

/* ── Light theme overrides ───────────────────────────────── */
.light-theme .site-header {
  background: linear-gradient(135deg, #f0f2f5, #e8edf2);
}
.light-theme .brand-name {
  color: #1a1a2e;
}
.light-theme .header-nav-link {
  color: #555;
}
.light-theme .header-nav-link:hover,
.light-theme .header-nav-link.active {
  color: #111;
  background: rgba(0,0,0,0.05);
}
.light-theme .header-icon-btn {
  background: rgba(0,0,0,0.06);
  color: #555;
}
.light-theme .header-icon-btn:hover {
  background: rgba(0,0,0,0.12);
  color: #111;
}
.light-theme .avatar-name {
  color: #333;
}
.light-theme .mega-panel {
  --mega-bg: rgba(245, 246, 250, 0.98);
  --mega-border: rgba(0,0,0,0.08);
  --mega-text: #444;
  --mega-text-muted: #888;
  --mega-hover: rgba(0,0,0,0.04);
}
.light-theme .mega-title {
  color: #1a1a2e;
}
.light-theme .mega-item.unread {
  color: #111;
}
.light-theme .header-avatar:hover {
  background: rgba(0,0,0,0.05);
}
.light-theme .avatar-circle {
  background: linear-gradient(135deg, #4f8cff, #6c63ff);
}

/* ── Mobile overrides ────────────────────────────────────── */
@media (max-width: 991.98px) {
  .header-nav { display: none; }
  .mega-panel-inner {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  .mega-col--desc { flex: auto; }
  .mega-col--content {
    flex-direction: column;
    gap: 1rem;
  }
}
