/**
 * Layout Component Styles
 * Header, navigation, and page structure
 */

/* ═══════════════════════════════════════════════════════════
   HEADER
   ══════════════════════════════════════════════════════════ */

.site-header {
  background: linear-gradient(135deg, #0d0d1a 0%, #1a1230 100%);
  border-bottom: var(--border-width-thin) solid var(--border-emphasis);
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  gap: var(--space-4);
}

.site-logo {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--interactive-primary);
  letter-spacing: var(--tracking-wide);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  transition: var(--transition-colors);
}

.site-logo:hover {
  color: var(--interactive-primary-hover);
}

.site-logo:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

.logo-icon {
  font-size: 1.5em;
  line-height: 1;
}

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.logo-subtitle {
  color: var(--text-secondary);
  font-weight: var(--font-light);
  font-size: var(--text-sm);
}

.logo-version {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-left: var(--space-2);
}


/* ═══════════════════════════════════════════════════════════
   AUTH BAR (Header Right Side)
   ══════════════════════════════════════════════════════════ */

.auth-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.auth-status {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.auth-status.logged-in {
  color: var(--status-info);
}


/* ═══════════════════════════════════════════════════════════
   MAIN CONTENT AREA
   ══════════════════════════════════════════════════════════ */

.site-main {
  min-height: calc(100vh - var(--header-height));
}

.page-header {
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-4);
  border-bottom: var(--border-width-thin) solid var(--border-subtle);
}

.page-title {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  color: var(--interactive-primary);
  margin-bottom: var(--space-2);
}

.page-description {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 65ch;
}


/* ═══════════════════════════════════════════════════════════
   GRID LAYOUTS
   ══════════════════════════════════════════════════════════ */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
}

@media (max-width: 768px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}


/* ═══════════════════════════════════════════════════════════
   SECTION DIVIDERS
   ══════════════════════════════════════════════════════════ */

.section {
  margin-bottom: var(--space-12);
}

.section-header {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--text-secondary);
  margin: var(--space-6) 0 var(--space-3);
  border-left: 2px solid var(--border-emphasis);
  padding-left: var(--space-2);
  font-weight: var(--font-semibold);
}

.divider {
  height: var(--border-width-thin);
  background: var(--border-subtle);
  margin: var(--space-8) 0;
  border: none;
}

.divider-text {
  position: relative;
  text-align: center;
  margin: var(--space-8) 0;
}

.divider-text::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: var(--border-width-thin);
  background: var(--border-subtle);
  z-index: 0;
}

.divider-text span {
  position: relative;
  z-index: 1;
  background: var(--bg-primary);
  padding: 0 var(--space-4);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}


/* ═══════════════════════════════════════════════════════════
   BADGES & PILLS
   ══════════════════════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  line-height: 1;
  white-space: nowrap;
}

.badge-primary {
  background: rgba(201, 168, 76, 0.15);
  border: var(--border-width-thin) solid rgba(201, 168, 76, 0.3);
  color: var(--interactive-primary);
}

.badge-secondary {
  background: rgba(106, 79, 200, 0.15);
  border: var(--border-width-thin) solid rgba(106, 79, 200, 0.4);
  color: var(--color-purple-300);
}

.badge-success {
  background: rgba(80, 200, 120, 0.15);
  border: var(--border-width-thin) solid rgba(80, 200, 120, 0.3);
  color: var(--status-success);
}

.badge-error {
  background: rgba(224, 80, 80, 0.15);
  border: var(--border-width-thin) solid rgba(224, 80, 80, 0.3);
  color: var(--status-error);
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}


/* ═══════════════════════════════════════════════════════════
   TOOLTIPS & HELP ICONS
   ══════════════════════════════════════════════════════════ */

.tooltip {
  position: relative;
  display: inline-block;
}

.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  background: rgba(106, 79, 200, 0.2);
  color: var(--color-purple-400);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  cursor: help;
  margin-left: var(--space-1);
  user-select: none;
  transition: var(--transition-colors);
  border: var(--border-width-thin) solid transparent;
}

.help-icon:hover {
  background: rgba(106, 79, 200, 0.3);
  border-color: rgba(106, 79, 200, 0.4);
}

.help-icon::before {
  content: "?";
}

/* Tooltip content - shown on hover */
.tooltip .tooltip-content {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + var(--space-2));
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  border: var(--border-width-thin) solid var(--border-subtle);
  font-size: var(--text-sm);
  font-weight: var(--font-normal);
  white-space: normal;
  width: 260px;
  max-width: 90vw;
  box-shadow: var(--shadow-xl);
  z-index: var(--z-tooltip);
  pointer-events: none;
  line-height: var(--leading-relaxed);
  text-align: left;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.tooltip:hover .tooltip-content,
.help-icon[aria-describedby]:hover ~ .tooltip-content {
  visibility: visible;
  opacity: 1;
}

/* Tooltip arrow */
.tooltip .tooltip-content::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--border-subtle);
}


/* ═══════════════════════════════════════════════════════════
   RESPONSIVE UTILITIES
   ══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .site-header {
    padding: 0 var(--space-4);
    height: 56px;
  }
  
  .site-logo {
    font-size: var(--text-lg);
  }
  
  .logo-subtitle,
  .logo-version {
    display: none;
  }
  
  .hide-mobile {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .show-mobile {
    display: none !important;
  }
}


/* ═══════════════════════════════════════════════════════════
   UTILITY CLASSES
   ══════════════════════════════════════════════════════════ */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: var(--space-2);
}

.gap-4 {
  gap: var(--space-4);
}

.mt-4 {
  margin-top: var(--space-4);
}

.mb-4 {
  margin-bottom: var(--space-4);
}
