/**
 * Wordnus Shell - Shared Header & Footer Styles
 * Common navigation and branding for all Wordnus pages
 */

/* === CSS Variables === */
:root {
  --wn-bg: #FAFBFC;
  --wn-bg-secondary: #FFFFFF;
  --wn-surface: rgba(255, 255, 255, 0.85);
  --wn-text: #0F172A;
  --wn-text-secondary: #475569;
  --wn-text-muted: #94A3B8;
  --wn-primary: #6366F1;
  --wn-primary-light: #818CF8;
  --wn-primary-dark: #4F46E5;
  --wn-primary-glow: rgba(99, 102, 241, 0.15);
  --wn-success: #10B981;
  --wn-warning: #F59E0B;
  --wn-border: rgba(0, 0, 0, 0.06);
  --wn-border-hover: rgba(0, 0, 0, 0.12);
  --wn-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --wn-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --wn-shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
  --wn-radius-sm: 8px;
  --wn-radius-md: 12px;
  --wn-radius-lg: 16px;
  --wn-font-display: 'Space Grotesk', system-ui, sans-serif;
  --wn-font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
  --wn-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --wn-duration: 300ms;
  --wn-duration-fast: 150ms;
  --wn-header-height: 64px;
}

[data-theme="dark"] {
  --wn-bg: #0B0F1A;
  --wn-bg-secondary: #151B2B;
  --wn-surface: rgba(21, 27, 43, 0.85);
  --wn-text: #F1F5F9;
  --wn-text-secondary: #CBD5E1;
  --wn-text-muted: #64748B;
  --wn-border: rgba(255, 255, 255, 0.08);
  --wn-border-hover: rgba(255, 255, 255, 0.15);
  --wn-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --wn-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --wn-shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.4);
}

/* === Wordnus Header === */
.wn-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--wn-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--wn-border);
  height: var(--wn-header-height);
}

.wn-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
}

/* Logo */
.wn-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--wn-text);
  flex-shrink: 0;
}

.wn-logo-icon {
  width: 32px;
  height: 32px;
}

.wn-logo-text {
  font-family: var(--wn-font-display);
  font-size: 1.125rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--wn-primary), var(--wn-primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Breadcrumb Navigation */
.wn-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--wn-text-muted);
  overflow: hidden;
}

.wn-breadcrumb-item {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.wn-breadcrumb-link {
  color: var(--wn-text-secondary);
  text-decoration: none;
  transition: color var(--wn-duration-fast);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wn-breadcrumb-link:hover {
  color: var(--wn-primary);
}

.wn-breadcrumb-current {
  color: var(--wn-text);
  font-weight: 600;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wn-breadcrumb-sep {
  color: var(--wn-text-muted);
  opacity: 0.5;
}

/* Header Right Actions */
.wn-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* XP Badge */
.wn-xp-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(249, 115, 22, 0.1));
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 100px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #D97706;
  transition: all var(--wn-duration-fast);
}

.wn-xp-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.wn-xp-icon {
  font-size: 1rem;
}

[data-theme="dark"] .wn-xp-badge {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(249, 115, 22, 0.15));
  color: #FBBF24;
}

/* User Menu */
.wn-user-menu {
  position: relative;
}

.wn-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  background: var(--wn-bg-secondary);
  border: 1px solid var(--wn-border);
  border-radius: 100px;
  cursor: pointer;
  transition: all var(--wn-duration-fast);
}

.wn-user-btn:hover {
  border-color: var(--wn-border-hover);
  box-shadow: var(--wn-shadow-sm);
}

.wn-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--wn-border);
}

.wn-user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--wn-text);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wn-user-chevron {
  color: var(--wn-text-muted);
  transition: transform var(--wn-duration-fast);
}

.wn-user-btn[aria-expanded="true"] .wn-user-chevron {
  transform: rotate(180deg);
}

/* User Dropdown */
.wn-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--wn-bg-secondary);
  border: 1px solid var(--wn-border);
  border-radius: var(--wn-radius-md);
  box-shadow: var(--wn-shadow-lg);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.95);
  transition: all var(--wn-duration) var(--wn-ease);
  z-index: 200;
}

.wn-user-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.wn-dropdown-header {
  padding: 12px;
  border-bottom: 1px solid var(--wn-border);
  margin-bottom: 8px;
}

.wn-dropdown-name {
  font-weight: 600;
  color: var(--wn-text);
  margin-bottom: 2px;
}

.wn-dropdown-email {
  font-size: 0.8125rem;
  color: var(--wn-text-muted);
  word-break: break-all;
}

.wn-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--wn-text);
  text-decoration: none;
  background: transparent;
  border: none;
  border-radius: var(--wn-radius-sm);
  cursor: pointer;
  transition: all var(--wn-duration-fast);
}

.wn-dropdown-item:hover {
  background: var(--wn-primary-glow);
  color: var(--wn-primary);
}

.wn-dropdown-item.danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #EF4444;
}

.wn-dropdown-divider {
  height: 1px;
  background: var(--wn-border);
  margin: 8px 0;
}

/* Mobile Menu Button */
.wn-mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  color: var(--wn-text);
  cursor: pointer;
}

/* Mobile Navigation */
.wn-mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 300;
  opacity: 0;
  visibility: hidden;
  transition: all var(--wn-duration);
}

.wn-mobile-overlay.open {
  opacity: 1;
  visibility: visible;
}

.wn-mobile-nav {
  position: absolute;
  top: 0;
  right: 0;
  width: 300px;
  max-width: 85%;
  height: 100%;
  background: var(--wn-bg-secondary);
  padding: 20px;
  transform: translateX(100%);
  transition: transform var(--wn-duration) var(--wn-ease);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.wn-mobile-overlay.open .wn-mobile-nav {
  transform: translateX(0);
}

.wn-mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.wn-mobile-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  color: var(--wn-text-muted);
  cursor: pointer;
}

.wn-mobile-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--wn-surface);
  border-radius: var(--wn-radius-md);
  margin-bottom: 20px;
}

.wn-mobile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.wn-mobile-user-info {
  flex: 1;
  min-width: 0;
}

.wn-mobile-name {
  font-weight: 600;
  color: var(--wn-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wn-mobile-xp {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8125rem;
  color: #D97706;
  font-weight: 600;
}

.wn-mobile-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.wn-mobile-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--wn-text);
  text-decoration: none;
  border-radius: var(--wn-radius-sm);
  transition: all var(--wn-duration-fast);
}

.wn-mobile-link:hover,
.wn-mobile-link.active {
  background: var(--wn-primary-glow);
  color: var(--wn-primary);
}

.wn-mobile-link svg {
  width: 20px;
  height: 20px;
  opacity: 0.7;
}

.wn-mobile-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--wn-border);
}

.wn-mobile-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #EF4444;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--wn-radius-md);
  cursor: pointer;
  transition: all var(--wn-duration-fast);
}

.wn-mobile-logout:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* === Content Offset for Shell Header === */
/* Add padding to body when shell header is present */
body:has(.wn-header) {
  padding-top: var(--wn-header-height);
}

/* Fallback for browsers that don't support :has() */
.wn-shell-active {
  padding-top: var(--wn-header-height);
}

/* For pages that have their own fixed/sticky headers below shell */
body:has(.wn-header) .set-header,
body:has(.wn-header) .wn-fixed-header,
body:has(.wn-header) .wn-adaptive-banner,
.wn-shell-active .set-header,
.wn-shell-active .wn-fixed-header,
.wn-shell-active .wn-adaptive-banner {
  top: var(--wn-header-height) !important;
}

/* For pages with sticky headers */
body:has(.wn-header) header.sticky:not(.wn-header),
.wn-shell-active header.sticky:not(.wn-header) {
  top: var(--wn-header-height) !important;
}

/* Adjust main content areas */
body:has(.wn-header) .wn-app,
body:has(.wn-header) #app,
.wn-shell-active .wn-app,
.wn-shell-active #app {
  min-height: calc(100vh - var(--wn-header-height));
}

/* === Wordnus Footer === */
.wn-footer {
  background: var(--wn-bg-secondary);
  border-top: 1px solid var(--wn-border);
  padding: 24px 20px;
  margin-top: auto;
}

.wn-footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 1400px;
  margin: 0 auto;
  text-align: center;
}

.wn-footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--wn-font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--wn-primary);
  text-decoration: none;
}

.wn-footer-tagline {
  font-size: 0.875rem;
  color: var(--wn-text-secondary);
  line-height: 1.5;
}

.wn-footer-tagline a {
  color: var(--wn-primary);
  text-decoration: none;
  font-weight: 600;
}

.wn-footer-tagline a:hover {
  text-decoration: underline;
}

.wn-footer-copy {
  font-size: 0.8125rem;
  color: var(--wn-text-muted);
}

/* === Responsive === */
@media (max-width: 768px) {
  .wn-breadcrumb {
    display: none;
  }

  .wn-xp-badge {
    padding: 4px 10px;
    font-size: 0.75rem;
  }

  .wn-user-name {
    display: none;
  }

  .wn-user-btn {
    padding: 4px;
  }

  .wn-mobile-menu-btn {
    display: flex;
  }

  .wn-header-actions > *:not(.wn-xp-badge):not(.wn-mobile-menu-btn) {
    display: none;
  }

  .wn-footer-inner {
    padding: 0 16px;
  }
}

@media (max-width: 480px) {
  .wn-header-inner {
    padding: 0 12px;
  }

  .wn-logo-text {
    font-size: 1rem;
  }

  .wn-xp-badge span:not(.wn-xp-icon) {
    display: none;
  }

  .wn-xp-badge {
    padding: 6px 8px;
  }
}
