/**
 * Engineering Toolkit — Shared Tool Header Styles
 * Link this in every tool page: <link rel="stylesheet" href="../../css/header.css">
 * Structure:
 *   <header>
 *     <div class="hdr">
 *       <div class="hdr-left">
 *         <a class="hdr-back-btn"> ... </a>
 *         <div class="hdr-icon"> ... </div>
 *         <div class="hdr-titles"><h1/><p/></div>
 *       </div>
 *       <div class="hdr-right">
 *         <!-- tool-specific action buttons (.hdr-btn or .hdr-btn-primary) -->
 *         <button id="auth-btn"> ... </button>
 *       </div>
 *     </div>
 *   </header>
 */

/* ── Container ─────────────────────────────────────────────── */
header {
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.90);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background var(--transition-fast);
  flex-shrink: 0;
}



/* ── Inner wrapper ─────────────────────────────────────────── */
.hdr {
  width: 100%;
  max-width: var(--max-width, 1600px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* ── Left group (back + icon + titles) ─────────────────────── */
.hdr-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* Back button */
.hdr-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.hdr-back-btn:hover {
  background: var(--accent-primary-glow);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}
.hdr-back-btn svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* Tool icon badge */
.hdr-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent-primary), #0891b2);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-primary-glow);
}
/* Match hub card icons (registryIcons) — white stroke on accent badge */
.hdr-icon svg,
.hdr-icon i[data-lucide] {
  width: 20px;
  height: 20px;
  max-width: 20px;
  max-height: 20px;
  stroke: currentColor;
  color: #fff;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.hdr-icon svg * {
  stroke: currentColor;
}

/* Title + subtitle
 * Tool pages do not load the hub's global * { margin:0 } reset, so browser
 * defaults on h1/p otherwise leave a large gap (looks like a blank line). */
.hdr-titles {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  line-height: 1.25;
}
.hdr-titles h1 {
  margin: 0;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}
.hdr-titles p {
  margin: 0;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
/* Title row when a status badge sits beside the h1 (e.g. Synced) */
.hdr-titles > div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.hdr-titles > div h1 {
  margin: 0;
}
.hdr-status-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 16px;
  line-height: 1;
  flex-shrink: 0;
  transition: opacity 0.3s ease;
}
.hdr-status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-success, #10b981);
  flex-shrink: 0;
}

/* ── Right group (action buttons) ──────────────────────────── */
.hdr-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Generic action button */
.hdr-btn {
  height: 36px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  font-family: var(--font-sans);
}
.hdr-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--text-muted);
}
.hdr-btn svg,
.hdr-btn i[data-lucide] {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* Teal accent action button (e.g. Share) */
.hdr-btn-accent {
  background: var(--accent-primary-glow);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}
.hdr-btn-accent:hover {
  background: var(--accent-primary);
  color: #fff;
}

/* ── Divider between button groups ─────────────────────────── */
.hdr-divider {
  width: 1px;
  height: 24px;
  background: var(--border-color);
  flex-shrink: 0;
}

/* ── Export dropdown (tool-exports.js) ─────────────────────── */
.et-export-dropdown {
  position: relative;
  display: inline-flex;
}
.et-export-trigger {
  gap: 4px;
}
.et-export-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 100;
  flex-direction: column;
  gap: 2px;
}
.et-export-menu.open {
  display: flex;
}
.et-export-item {
  appearance: none;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}
.et-export-item:hover {
  background: var(--accent-primary-glow);
  color: var(--accent-primary);
}

/* ── Responsive: collapse on small screens ──────────────────── */
@media (max-width: 640px) {
  header { padding: 0 16px; height: auto; min-height: 64px; }
  .hdr { flex-wrap: wrap; padding: 12px 0; gap: 10px; }
  .hdr-right { flex-wrap: wrap; }
  .hdr-btn span { display: none; }
  .hdr-btn { padding: 0 10px; }
}
