/**
 * MagnusIBA Universal Auth Header Styles
 */

/* Auth Header Container */
.auth-header {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* Sign In Button (not signed in) */
.auth-header__signin {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  background: linear-gradient(135deg, #047857, #059669);
  color: white;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 10px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(4, 120, 87, 0.25);
}

.auth-header__signin:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(4, 120, 87, 0.35);
}

/* User Button (signed in) */
.auth-header__user {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 4px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-header__user:hover {
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.auth-header__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.auth-header__initials {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #047857, #059669);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-header__chevron {
  color: #64748b;
  transition: transform 0.2s ease;
}

.auth-header__user[aria-expanded="true"] .auth-header__chevron {
  transform: rotate(180deg);
}

/* Dropdown Menu */
.auth-header__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  z-index: 1000;
  overflow: hidden;
}

.auth-header__dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.auth-header__dropdown-header {
  padding: 16px;
  background: #f8fafc;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.auth-header__dropdown-name {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 2px;
}

.auth-header__dropdown-email {
  display: block;
  font-size: 0.8125rem;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-header__dropdown-divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.05);
}

.auth-header__dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: #334155;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.auth-header__dropdown-item:hover {
  background: #f1f5f9;
}

.auth-header__dropdown-item svg {
  color: #64748b;
  flex-shrink: 0;
}

.auth-header__dropdown-item--danger {
  color: #dc2626;
}

.auth-header__dropdown-item--danger svg {
  color: #dc2626;
}

.auth-header__dropdown-item--danger:hover {
  background: #fef2f2;
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
  .auth-header__user {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
  }

  .auth-header__user:hover {
    background: #1e293b;
  }

  .auth-header__dropdown {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.1);
  }

  .auth-header__dropdown-header {
    background: #0f172a;
    border-color: rgba(255, 255, 255, 0.05);
  }

  .auth-header__dropdown-name {
    color: #f1f5f9;
  }

  .auth-header__dropdown-email {
    color: #94a3b8;
  }

  .auth-header__dropdown-item {
    color: #e2e8f0;
  }

  .auth-header__dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
  }

  .auth-header__dropdown-item svg {
    color: #94a3b8;
  }

  .auth-header__dropdown-item--danger:hover {
    background: rgba(220, 38, 38, 0.1);
  }
}

/* Explicit dark class for pages that use it */
.dark .auth-header__user,
[data-theme="dark"] .auth-header__user {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(255, 255, 255, 0.1);
}

.dark .auth-header__dropdown,
[data-theme="dark"] .auth-header__dropdown {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.1);
}

.dark .auth-header__dropdown-header,
[data-theme="dark"] .auth-header__dropdown-header {
  background: #0f172a;
}

.dark .auth-header__dropdown-name,
[data-theme="dark"] .auth-header__dropdown-name {
  color: #f1f5f9;
}

.dark .auth-header__dropdown-item,
[data-theme="dark"] .auth-header__dropdown-item {
  color: #e2e8f0;
}

.dark .auth-header__dropdown-item:hover,
[data-theme="dark"] .auth-header__dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Mobile Adjustments */
@media (max-width: 640px) {
  .auth-header__dropdown {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    min-width: 100%;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }

  .auth-header__dropdown.open {
    transform: translateY(0);
  }

  .auth-header__dropdown-item {
    padding: 16px 20px;
  }
}
