/**
 * Unified Header - 3 Column Layout FIXED
 * Proper alignment with flexible center
 */

/* The container - full width background */
.unified-header {
  width: 100%;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* 3-column grid constrained to 800px */
.unified-header-grid {
  display: grid !important;
  grid-template-rows: 48px 48px !important;
  grid-template-columns: 180px 1fr 150px !important;
  padding: 0 16px !important;
  max-width: 800px !important;
  width: 100% !important;
  margin: 0 auto !important;
  box-sizing: border-box !important;
}

/* App Icon - Spans 2x2 grid area */
.app-icon-button {
  grid-row: 1 / 3;  /* Spans both rows */
  grid-column: 1;
  width: 160px !important;
  height: 160px !important;
  justify-self: start;  /* Left align */
  align-self: center;
  background: transparent !important;
  border: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer;
  transition: all 0.2s ease;
  overflow: visible !important;
}

.app-icon-button:hover {
  transform: scale(1.05);
}

.app-icon-button svg {
  width: 140px !important;
  height: 140px !important;
}

/* Row 1 Column 2 - Title */
.app-title-button {
  grid-row: 1;
  grid-column: 2;
  justify-self: center;
  align-self: center;
}

/* Row 1 Column 3 - Right icons container */
.row-1-right {
  grid-row: 1;
  grid-column: 3;
  display: flex;
  gap: 8px;
  justify-self: end;
  align-self: center;
}

/* Row 2 Column 2 - Greeting */
#header-greeting {
  grid-row: 2;
  grid-column: 2;
  justify-self: center;
  align-self: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Row 2 Column 2 - Task context label */
#task-context-label {
  grid-row: 2;
  grid-column: 2;
  justify-self: center;
  align-self: center;
  text-align: center;
}

/* Row 2 Column 3 - Badges container */
.row-2-right {
  grid-row: 2;
  grid-column: 3;
  display: flex;
  gap: 8px;
  justify-self: end;
  align-self: center;
}

/* Icon button styles */
.theme-toggle,
.notifications-btn,
.header-sign-out-icon {
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 150ms ease;
}

.theme-toggle:hover:not(:disabled),
.notifications-btn:hover:not(:disabled),
.header-sign-out-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.notifications-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Badge styles - Remove ALL backgrounds */
.unified-header .streak-badge,
.unified-header .xp-badge,
.unified-header .mastery-badge,
.unified-header .streak-badge-component,
.unified-header .xp-badge-component,
.unified-header .mastery-badge-component,
.unified-header-grid .streak-badge,
.unified-header-grid .xp-badge,
.unified-header-grid .mastery-badge,
.unified-header-grid .streak-badge-component,
.unified-header-grid .xp-badge-component,
.unified-header-grid .mastery-badge-component,
.row-2-right .streak-badge,
.row-2-right .xp-badge,
.row-2-right .mastery-badge,
.row-2-right .streak-badge-component,
.row-2-right .xp-badge-component,
.row-2-right .mastery-badge-component,
#streak-badge,
#xp-badge,
#mastery-badge {
  display: inline-flex !important;
  align-items: center !important;
  height: 32px !important;
  padding: 0 8px !important;
  gap: 4px !important;
  font-size: 13px;
  color: var(--text-secondary);
  background: none !important;
  background-color: transparent !important;
  background-image: none !important;
  border: none !important;
  box-shadow: none !important;
}

/* Icon sizing */
.unified-header svg {
  width: 18px;
  height: 18px;
}

.streak-badge svg,
.xp-badge svg,
.mastery-badge svg {
  width: 16px;
  height: 16px;
}

/* Debug grid overlay */
/*
.unified-header-grid {
  background-image: 
    repeating-linear-gradient(90deg, rgba(255,0,0,0.1) 0, rgba(255,0,0,0.1) 1px, transparent 1px, transparent 150px),
    repeating-linear-gradient(0deg, rgba(255,0,0,0.1) 0, rgba(255,0,0,0.1) 1px, transparent 1px, transparent 48px);
}
*/

/* Dark mode specific - ensure no backgrounds on badges */
[data-theme="dark"] .unified-header .streak-badge,
[data-theme="dark"] .unified-header .xp-badge,
[data-theme="dark"] .unified-header .mastery-badge,
[data-theme="dark"] .unified-header .streak-badge-component,
[data-theme="dark"] .unified-header .xp-badge-component,
[data-theme="dark"] .unified-header .mastery-badge-component,
[data-theme="dark"] #streak-badge,
[data-theme="dark"] #xp-badge,
[data-theme="dark"] #mastery-badge {
  background: none !important;
  background-color: transparent !important;
  background-image: none !important;
  border: none !important;
  box-shadow: none !important;
}

/* Responsive */
@media (max-width: 768px) {
  .unified-header-grid {
    grid-template-columns: 100px 1fr 100px !important;
    padding: 0 12px !important;
  }
  
  #header-greeting {
    font-size: 16px;
  }
  
  /* Hide badge text on mobile */
  .streak-badge span:not(:first-child),
  .xp-badge span:not(:first-child),
  .mastery-badge span:not(:first-child) {
    display: none;
  }
  
  .unified-header .streak-badge,
  .unified-header .xp-badge,
  .unified-header .mastery-badge,
  .unified-header .streak-badge-component,
  .unified-header .xp-badge-component,
  .unified-header .mastery-badge-component,
  #streak-badge,
  #xp-badge,
  #mastery-badge {
    padding: 0 4px !important;
    background: none !important;
    background-color: transparent !important;
    border: none !important;
  }
}
