/**
 * Modern Header - Glassmorphism with depth
 */

@import './design-system.css';

.header {
  background: linear-gradient(
    135deg,
    rgba(20, 20, 25, 0.92) 0%,
    rgba(30, 30, 36, 0.88) 100%
  );
  backdrop-filter: var(--glass-blur) saturate(180%);
  -webkit-backdrop-filter: var(--glass-blur) saturate(180%);

  border-bottom: 1px solid rgba(99, 102, 241, 0.2);
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: var(--z-sticky);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);

  /* Auto-hide: translate up out of view */
  transform: translateY(0);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity  0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hidden state — slides up off screen */
.header.header-hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

/* Temp-visible on touch (mobile fullscreen) */
.header.show-temp {
  transform: translateY(0) !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.header-left #info {
  font-size: 16px;
  font-weight: 600;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

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

.status {
  font-size: 13px;
  color: var(--text-tertiary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Animated status indicator */
.status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success-500);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(0.9);
  }
}

/* Download button with text */
.btn-download {
  /* Glassmorphism */
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.15),
    rgba(99, 102, 241, 0.1)
  );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  border: 1px solid rgba(99, 102, 241, 0.2);
  color: var(--text-primary);
  height: 44px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;

  /* Smooth transitions */
  transition: all var(--transition-base);

  /* Subtle inner shadow for depth */
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.1),
    0 2px 8px rgba(99, 102, 241, 0.15);

  position: relative;
  overflow: hidden;
}

.btn-download::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--transition-base);
  z-index: -1;
  pointer-events: none;
}

.btn-download:hover::before {
  opacity: 0.25;
}

.btn-download:hover {
  transform: translateY(-2px) scale(1.02);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.15),
    0 4px 16px rgba(99, 102, 241, 0.3),
    0 2px 8px rgba(0, 0, 0, 0.12);
}

.btn-download:active {
  transform: translateY(0) scale(0.98);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.2),
    0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Modern icon buttons */
.icon-btn {
  /* Glassmorphism */
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1),
    rgba(255, 255, 255, 0.05)
  );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;

  /* Smooth transitions */
  transition: all var(--transition-base);

  /* Subtle inner shadow for depth */
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.1),
    0 2px 8px rgba(0, 0, 0, 0.1);

  position: relative;
  overflow: hidden;
}

/* Hover effect with gradient */
.icon-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--transition-base);
  z-index: -1;
}

.icon-btn:hover::before {
  opacity: 0.15;
}

.icon-btn:hover {
  transform: translateY(-2px) scale(1.05);
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.15),
    0 4px 16px rgba(99, 102, 241, 0.2),
    0 2px 8px rgba(0, 0, 0, 0.12);
}

.icon-btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.2),
    0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Hamburger menu */
.hamburger-menu {
  position: relative;
}

.menu-dropdown {
  position: absolute;
  top: 54px;
  right: 0;
  min-width: 240px;

  /* Modern glassmorphism card */
  background: linear-gradient(
    135deg,
    rgba(20, 20, 25, 0.95),
    rgba(30, 30, 36, 0.92)
  );
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);

  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 8px;

  display: none;
  z-index: var(--z-dropdown);

  /* Layered shadows for depth */
  box-shadow:
    0 20px 48px rgba(0, 0, 0, 0.4),
    0 8px 24px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.menu-dropdown.show {
  display: block;
  animation: dropdownSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes dropdownSlide {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.menu-item {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

/* Gradient hover effect */
.menu-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: -1;
}

.menu-item:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(4px);
}

.menu-item:hover::before {
  opacity: 0.1;
}

.menu-item:active {
  transform: translateX(2px) scale(0.98);
}

.menu-item:last-child {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 8px;
  padding-top: 16px;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .header {
    padding: 12px 20px;
    -webkit-tap-highlight-color: transparent;
  }

  .header-left #info {
    font-size: 14px;
  }

  .btn-download {
    height: 48px;
    padding: 0 16px;
    font-size: 14px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
  }

  .btn-download:active {
    transform: scale(0.95);
  }

  .icon-btn {
    width: 48px;
    height: 48px;
    font-size: 20px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
  }

  .icon-btn:active {
    transform: scale(0.92);
  }

  .menu-dropdown {
    min-width: 220px;
    right: -4px;
    top: 58px;
  }

  .menu-item {
    padding: 16px 20px;
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
}
