/* ── Header layout ───────────────────────────────────────────────── */
.header {
  background-color: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo img { height: 40px; }

.brand-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.brand-fallback {
  display: none;
  font-size: 1.1rem;
  font-weight: 700;
  color: #111827;
}

/* ── Nav ─────────────────────────────────────────────────────────── */
.nav-menu {
  display: flex;
  gap: 2.5rem;
  list-style: none;
  align-items: center;
}

.nav-menu a {
  text-decoration: none;
  color: #1a1a1a;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.3px;
  transition: color 0.2s;
  white-space: nowrap;
}

.nav-menu a:hover,
.nav-menu a.active { color: #4a5568; }

/* ── CTA buttons ─────────────────────────────────────────────────── */
.cta-buttons {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* line-height:1 prevents body's 1.6 line-height from making the buttons
   taller than the profile pill, which causes the header height to shift
   when auth state changes. */
.btn-primary {
  background-color: #000000;
  color: #ffffff;
  padding: 0.6rem 1.5rem;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  transition: background-color 0.2s;
  border: none;
  cursor: pointer;
}

.btn-primary:hover { background-color: #2d3748; }

.btn-secondary {
  background-color: transparent;
  color: #1a1a1a;
  padding: 0.6rem 1.5rem;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  border: 1px solid #e5e7eb;
  transition: all 0.2s;
  cursor: pointer;
}

.btn-secondary:hover { background-color: #f9fafb; }

.cta-buttons.auth-loading {
  min-height: 40px;
}

/* Smooth auth-state reveal — fade instead of snap */
.cta-buttons .auth-login-btn,
.cta-buttons .btn-primary,
.cta-buttons .user-profile-wrap {
  transition: opacity 0.25s ease;
}

.cta-buttons.auth-loading .auth-login-btn,
.cta-buttons.auth-loading .btn-primary,
.cta-buttons.auth-loading .user-profile-wrap {
  opacity: 0;
  pointer-events: none;
}

.user-profile-wrap {
  display: none;
  position: relative;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 6px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.user-profile:hover {
  border-color: #d1d5db;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.07);
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #111827 0%, #374151 100%);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
}

.user-profile i {
  color: #9ca3af;
  font-size: 11px;
  transition: transform 0.2s ease;
}

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

/* ── Profile dropdown ────────────────────────────────────── */

.profile-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 280px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.10), 0 4px 12px rgba(15, 23, 42, 0.05);
  overflow: hidden;
  z-index: 200;
  opacity: 0;
  transform: translateY(-6px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.profile-dropdown.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ── Dropdown header ── */
.pd-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 14px 12px;
  background: #f9fafb;
}

.pd-av {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #111827 0%, #374151 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.pd-info {
  flex: 1;
  min-width: 0;
}

.pd-info-email {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 5px;
}

/* Plan status pill */
.pd-plan-pill {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: #f3f4f6;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pd-plan-active    { background: #ecfdf5; color: #059669; }
.pd-plan-trialing  { background: #ecfdf5; color: #059669; }
.pd-plan-inactive,
.pd-plan-canceled,
.pd-plan-past_due  { background: #fef3c7; color: #b45309; }

/* ── Divider ── */
.pd-divider {
  height: 1px;
  background: #f3f4f6;
  margin: 0;
}

/* ── Icon chips ── */
.pd-icon-chip {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pd-icon-chip i {
  font-size: 11px;
}

.pd-icon-chip--amber,
.pd-icon-chip--indigo,
.pd-icon-chip--red { background: #e5e7eb; color: #374151; }

/* ── Credits section ── */
.pd-section {
  padding: 12px 14px;
}

.pd-section-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 10px;
}

.pd-credits-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.pd-credits-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 9px;
  text-align: center;
}

.pd-credits-box--balance {
  background: #f9fafb;
  border-color: #d1d5db;
  border-top: 2px solid #111827;
}

.pd-credits-box-value {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  line-height: 1;
}

.pd-credits-box-label {
  font-size: 10px;
  font-weight: 500;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pd-section-foot {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #9ca3af;
}

.pd-section-foot i {
  font-size: 10px;
}

/* ── Low credits alert ── */
.pd-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fffbeb;
  border-top: 1px solid #fde68a;
  border-bottom: 1px solid #fde68a;
  padding: 8px 14px;
  font-size: 12px;
  color: #92400e;
}

.pd-alert i {
  font-size: 11px;
  color: #d97706;
  flex-shrink: 0;
}

.pd-alert a {
  color: #b45309;
  font-weight: 600;
  text-decoration: underline;
}

/* ── Menu items ── */
.pd-menu {
  padding: 6px;
}

.pd-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease;
}

.pd-menu-item:hover {
  background: #f3f4f6;
}

.pd-menu-signout {
  color: #374151;
}

.pd-menu-signout:hover {
  background: #fef2f2;
  color: #ef4444;
}

.pd-menu-signout:hover .pd-icon-chip--red {
  background: #fee2e2;
  color: #ef4444;
}

/* ── Page transitions ─────────────────────────────────────────────── */
@keyframes hdr-page-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

body {
  animation: hdr-page-in 0.18s ease both;
  transition: opacity 0.15s ease;
}

body.page-leaving {
  opacity: 0;
  pointer-events: none;
}
