/* app-header.css - Professional app header with material + flat design */

/* === APP HEADER === */
.app-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(10, 13, 18, 0.98);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .app-header {
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.05);
}

.app-header-container {
  max-width: 100%;
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 48px;
  flex: 1;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
}

.app-brand {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, #5B8CFF 0%, #22D3EE 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-nav {
  display: flex !important;
  align-items: center;
  gap: 4px;
  flex: 1;
  visibility: visible !important;
}

.app-nav-item {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text) !important;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex !important;
  align-items: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0.85;
  position: relative;
  white-space: nowrap;
  visibility: visible !important;
  border: 1px solid transparent;
}

.app-nav-item:hover {
  background: rgba(91, 140, 255, 0.15);
  transform: translateY(-1px);
  color: #ffffff !important;
  opacity: 1;
  border-color: rgba(91, 140, 255, 0.3);
  box-shadow: 0 4px 12px rgba(91, 140, 255, 0.2);
}

html[data-theme="light"] .app-nav-item:hover {
  background: rgba(91, 140, 255, 0.12);
  color: #0a0d12 !important;
  border-color: rgba(91, 140, 255, 0.25);
  box-shadow: 0 4px 12px rgba(91, 140, 255, 0.15);
}

.app-nav-item.is-active {
  background: rgba(91, 140, 255, 0.2);
  color: #5B8CFF !important;
  box-shadow: 0 2px 8px rgba(91, 140, 255, 0.25);
  opacity: 1;
  border-color: rgba(91, 140, 255, 0.4);
}

html[data-theme="light"] .app-nav-item.is-active {
  background: rgba(91, 140, 255, 0.15);
  color: #5B8CFF !important;
  box-shadow: 0 2px 8px rgba(91, 140, 255, 0.2);
  border-color: rgba(91, 140, 255, 0.3);
}

.app-nav-item.is-active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20px;
  right: 20px;
  height: 2px;
  background: linear-gradient(90deg, #5B8CFF, #22D3EE);
  border-radius: 2px 2px 0 0;
}

.app-nav-item .icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

/* === PROFILE BUTTON WITH AVATAR === */
.app-nav-item.profile-with-avatar {
  padding: 6px 16px 6px 6px;
  gap: 10px;
}

/* Header Avatar Ring - Base */
.header-avatar-ring {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(135deg, #5B8CFF, #A78BFA);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  position: relative;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.header-avatar-ring img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.app-nav-item:hover .header-avatar-ring {
  transform: scale(1.08);
}

/* Free Tier - Default */
.header-avatar-ring.tier-free {
  background: linear-gradient(135deg, #5B8CFF, #A78BFA);
}

.app-nav-item:hover .header-avatar-ring.tier-free {
  box-shadow: 0 4px 16px rgba(91, 140, 255, 0.4);
}

/* Pro Tier - Animated Blue/Cyan */
.header-avatar-ring.tier-pro {
  padding: 2.5px;
  background: linear-gradient(135deg, #5B8CFF, #22D3EE);
  background-size: 200% 200%;
  animation: headerProGradient 2s ease infinite;
  box-shadow:
    0 4px 16px rgba(91, 140, 255, 0.5),
    0 0 24px rgba(34, 211, 238, 0.3);
}

.app-nav-item:hover .header-avatar-ring.tier-pro {
  box-shadow:
    0 6px 20px rgba(91, 140, 255, 0.6),
    0 0 32px rgba(34, 211, 238, 0.4);
}

/* Lifetime Tier - Animated Gold */
.header-avatar-ring.tier-lifetime {
  padding: 2.5px;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  background-size: 200% 200%;
  animation: headerLifetimeGradient 2s ease infinite;
  box-shadow:
    0 4px 16px rgba(255, 215, 0, 0.6),
    0 0 24px rgba(255, 165, 0, 0.4);
}

.app-nav-item:hover .header-avatar-ring.tier-lifetime {
  box-shadow:
    0 6px 20px rgba(255, 215, 0, 0.7),
    0 0 32px rgba(255, 165, 0, 0.5);
}

/* Supporter Tier - Animated Rainbow */
.header-avatar-ring.tier-supporter {
  padding: 2.5px;
  background: linear-gradient(45deg,
    #FF6B6B, #F06595, #CC5DE8, #845EF7,
    #5C7CFA, #339AF0, #22B8CF, #20C997,
    #51CF66, #94D82D, #FCC419, #FF922B,
    #FF6B6B
  );
  background-size: 300% 300%;
  animation: headerRainbowGradient 3s linear infinite;
  box-shadow:
    0 4px 16px rgba(255, 107, 107, 0.5),
    0 0 24px rgba(132, 94, 247, 0.3);
}

.app-nav-item:hover .header-avatar-ring.tier-supporter {
  box-shadow:
    0 6px 20px rgba(255, 107, 107, 0.6),
    0 0 32px rgba(132, 94, 247, 0.4);
}

/* Animations */
@keyframes headerProGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes headerLifetimeGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes headerRainbowGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Mobile menu avatar styling */
.mobile-menu-item .header-avatar-ring {
  width: 36px;
  height: 36px;
}

html[data-theme="light"] .header-avatar-ring.tier-free {
  background: linear-gradient(135deg, #5B8CFF, #A78BFA);
}

/* === THEME TOGGLE ENHANCEMENTS === */
#themeToggle:hover {
  background: rgba(91, 140, 255, 0.15);
  border-color: rgba(91, 140, 255, 0.3);
}

html[data-theme="light"] #themeToggle:hover {
  background: rgba(91, 140, 255, 0.12);
}

/* === APP LAYOUT === */
.app {
  min-height: calc(100vh - 64px);
  background: var(--bg);
}

.app-workspace {
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
}

/* Update panel styling for app */
.panel {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  width: 100%;
  min-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
}

.panel.glass {
  background: transparent !important;
  backdrop-filter: none !important;
}

/* === PANEL HEAD === */
.panel__head {
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 24px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.panel__head .title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.panel__head .actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Panel content area */
.panel > *:not(.panel__head) {
  flex: 1;
  overflow-y: auto;
}

/* === CARD STYLING === */
.card {
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
}

/* === HAMBURGER MENU === */
.hamburger-menu {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 1001;
  border-radius: 8px;
  transition: background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.hamburger-menu:hover,
.hamburger-menu:active {
  background: rgba(91, 140, 255, 0.15);
}

.hamburger-menu span {
  display: block;
  width: 100%;
  height: 2.5px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hamburger-menu.active span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.hamburger-menu.active span:nth-child(2) {
  opacity: 0;
  transform: translateX(-10px);
}

.hamburger-menu.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.mobile-menu-overlay.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* Mobile Menu */
.mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  right: -100%;
  width: 280px;
  max-width: 85vw;
  height: 100vh;
  background: rgba(10, 13, 18, 0.98);
  backdrop-filter: blur(20px);
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: -4px 0 30px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  padding: 80px 20px 20px;
}

html[data-theme="light"] .mobile-menu {
  background: rgba(255, 255, 255, 0.98);
  border-left: 1px solid rgba(0, 0, 0, 0.08);
}

.mobile-menu.active {
  display: block;
  right: 0;
}

.mobile-menu-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mobile-menu-item {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 16px 20px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  width: 100%;
  border: 1px solid transparent;
  opacity: 0.85;
}

.mobile-menu-item:hover {
  background: rgba(91, 140, 255, 0.15);
  transform: translateX(-4px);
  opacity: 1;
  border-color: rgba(91, 140, 255, 0.3);
  box-shadow: 0 4px 12px rgba(91, 140, 255, 0.2);
}

html[data-theme="light"] .mobile-menu-item:hover {
  background: rgba(91, 140, 255, 0.12);
  border-color: rgba(91, 140, 255, 0.25);
  box-shadow: 0 4px 12px rgba(91, 140, 255, 0.15);
}

.mobile-menu-item.is-active {
  background: rgba(91, 140, 255, 0.2);
  color: #5B8CFF;
  opacity: 1;
  border-color: rgba(91, 140, 255, 0.4);
}

html[data-theme="light"] .mobile-menu-item.is-active {
  background: rgba(91, 140, 255, 0.15);
  border-color: rgba(91, 140, 255, 0.3);
}

.mobile-menu-item .icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

.mobile-menu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 12px 0;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .app-header-container {
    padding: 0 20px;
  }

  .app-header-left {
    gap: 24px;
  }

  .app-nav {
    gap: 0;
  }

  .app-nav-item span {
    display: none;
  }

  .app-nav-item {
    padding: 10px 12px;
  }
}

@media (max-width: 768px) {
  .app-header-container {
    height: 56px;
    padding: 0 16px;
    gap: 12px;
  }

  .app-header-left {
    flex: 0;
    gap: 0;
  }

  /* Hide ChromaPilot text on mobile */
  .app-brand {
    display: none;
  }

  .app-logo svg {
    width: 32px;
    height: 32px;
  }

  /* Center the main navigation modes */
  .app-nav {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    gap: 2px;
    display: flex !important;
    visibility: visible !important;
  }

  .app-nav-item {
    padding: 8px;
    border-radius: 8px;
    display: flex !important;
    visibility: visible !important;
  }

  .app-nav-item span {
    display: none;
  }

  .app-nav-item .icon {
    width: 22px;
    height: 22px;
  }

  .app-nav-item.is-active::after {
    left: 8px;
    right: 8px;
  }

  /* Hide right side items, show hamburger */
  .app-header-right > .app-nav-item {
    display: none !important;
    visibility: hidden !important;
  }

  .hamburger-menu {
    display: flex !important;
    visibility: visible !important;
  }

  /* Enable mobile menu display */
  .mobile-menu-overlay {
    display: none;
  }

  .mobile-menu {
    display: none;
  }

  .mobile-menu-overlay.active {
    display: block !important;
  }

  .mobile-menu.active {
    display: block !important;
  }

  .panel {
    padding: 20px 16px;
    min-height: calc(100vh - 56px);
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  .app-header-container {
    padding: 0 12px;
  }

  .app-nav {
    gap: 0;
  }

  .app-nav-item {
    padding: 6px;
  }

  .app-nav-item .icon {
    width: 20px;
    height: 20px;
  }

  .mobile-menu {
    width: 100%;
    max-width: 280px;
  }
}

/* === AUTH BUTTON VISIBILITY === */
/* Login button - hidden by default, shown when not logged in */
.auth-hide-when-logged-in {
  display: none !important;
}

/* Show login button when body has not-authenticated class */
body.not-authenticated .auth-hide-when-logged-in {
  display: flex !important;
}
