/**
 * Header Component
 * Top navigation bar with logo and actions
 * 
 * Dependencies: chat-tokens.css
 */

/* ============================================
   BASE HEADER
   ============================================ */

.header-with-centered-logo {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0.8rem var(--chat-space-2xl);
  background: var(--clr-primary);
  color: var(--chat-bg-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--chat-z-header);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* ============================================
   HEADER SECTIONS
   ============================================ */

.header-left {
  display: flex;
  align-items: center;
  gap: var(--chat-space-md);
}

.header-logo-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
}

.celia-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--chat-space-md);
}

/* ============================================
   MENU TOGGLE
   ============================================ */

.header-with-centered-logo .menu-toggle {
  color: var(--chat-bg-primary);
}

.header-with-centered-logo .menu-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ============================================
   BACK BUTTON
   ============================================ */

.header-back-btn {
  display: flex;
  align-items: center;
  gap: var(--chat-space-sm);
  background: rgba(255, 255, 255, 0.15);
  color: var(--chat-bg-primary);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--chat-radius-md);
  padding: var(--chat-space-sm) var(--chat-space-md);
  font-size: var(--chat-font-size-md);
  font-weight: var(--chat-font-weight-semibold);
  cursor: pointer;
  transition: var(--chat-transition-all);
}

.header-back-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateX(-2px);
}

.header-back-btn:active {
  transform: translateX(-1px);
}

.header-back-btn .material-symbols-outlined {
  font-size: 1.25rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .header-with-centered-logo {
    padding: 0.6rem var(--chat-space-lg);
  }

  .celia-logo {
    height: 32px;
  }

  .header-actions {
    gap: var(--chat-space-sm);
  }

  .header-back-btn {
    padding: 0.4rem 0.6rem;
    font-size: var(--chat-font-size-base);
  }

  .header-back-btn .back-text {
    display: none;
  }

  .header-back-btn .material-symbols-outlined {
    font-size: 1.15rem;
  }
}

/* ============================================
   LEGACY STYLES (from main.css)
   TODO: Refactor to use component tokens
   ============================================ */

/* Header title */
.header-title {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 1px;
}

/* Logo sizing unified */
.celia-logo {
  height: 64px;
  max-height: calc(var(--header-height) - 18px);
  width: auto;
  display: block;
  object-fit: contain;
}

.header-with-centered-logo .celia-logo,
header.header-main .celia-logo {
  height: 64px !important;
  max-height: calc(var(--header-height) - 18px) !important;
}

/* Header grid system fixes */
.header-with-centered-logo {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background-color: var(--clr-primary);
  display: grid !important;
  grid-template-columns: 1fr auto 1fr !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: var(--shadow-header);
  z-index: 110;
  padding: 0 1.5rem;
}

.header-logo-wrapper {
  grid-column: 2;
  justify-self: center !important;
  display: flex !important;
  align-items: center !important;
}

.header-left {
  position: static !important;
  transform: none !important;
  justify-self: start !important;
  display: flex;
  align-items: center;
  gap: var(--chat-space-md);
}

.header-actions {
  position: static !important;
  transform: none !important;
  justify-self: end !important;
  right: 1.5rem;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--chat-space-md);
}

/* Legacy header fixes */
header.header-main .header-left {
  position: static !important;
  left: auto !important;
  top: auto !important;
  transform: none !important;
}

header.header-main .header-right {
  margin-left: auto !important;
}

/* Menu wrapper */
.menu-wrapper {
  margin-right: 0 !important;
}

.header-actions .menu-wrapper,
.header-right .menu-wrapper {
  margin-left: 0.75rem !important;
}

/* Sidebar toggle in header */
.coachbot-app .header-with-centered-logo .header-left {
  justify-self: start;
  padding-left: 1rem;
}

.coachbot-app .header-with-centered-logo .sidebar-toggle {
  width: 48px !important;
  height: 48px !important;
  border: none !important;
  border-radius: 10px;
  background: transparent !important;
  color: #fff !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px !important;
  line-height: 1 !important;
  padding: 0 !important;
  box-shadow: none !important;
  cursor: pointer;
}

.coachbot-app .header-with-centered-logo .sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.15) !important;
}

.coachbot-app .header-with-centered-logo .sidebar-toggle:active {
  background: rgba(255, 255, 255, 0.22) !important;
}

/* Resume conversation button */
#resumeConversationBtn {
  display: none;
  position: fixed;
  top: calc(var(--header-height) + 10px);
  right: 1.5rem;
  z-index: 200;
  background-color: #fef9c3;
  color: #92400e;
  font-weight: 500;
  border: 1.5px solid #fde68a;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

#resumeConversationBtn:hover {
  background-color: #fde68a;
  color: #7c2d12;
  border-color: #facc15;
}

.resume-button {
  background-color: #0a84ff;
  color: white;
  font-weight: 500;
  padding: 0.55rem 1.2rem;
  border-radius: 10px;
  margin-left: 0.6rem;
  display: none;
  transition: background-color 0.25s ease;
}

.resume-button:hover {
  background-color: #006ee6;
}

/* Close conversation button */
#closeConversationBtn {
  background: #f87171;
  color: #fff;
  border: none;
  border-radius: 2em;
  font-size: 1em;
  font-weight: 600;
  padding: 0 1.3em;
  height: 2.4em;
  min-width: 70px;
  margin-left: 0.5em;
  cursor: pointer;
  transition: background 0.18s;
  box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.03);
  display: inline-block;
  outline: none;
}

#closeConversationBtn:hover,
#closeConversationBtn:focus {
  background: #ef4444;
}

/* Admin badge */
.admin-badge {
  background: #fde68a;
  color: #92400e;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.2rem 0.6rem;
  border-radius: 0.5rem;
  margin-left: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* Mobile logo size */
@media (max-width: 600px) {
  .celia-logo {
    height: 48px !important;
    max-height: 48px !important;
  }
}
