/* public/assets/ui/framework/06_header.css
   KomodUI Header v0.1
   Goal: stable header on mobile (no horizontal overflow).
*/

/* Header shell */
.main-header {
  background: var(--color-bg-white);
  border-bottom: 1px solid var(--color-border);
  height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  width: 100%;
}

/* Inner row */
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: var(--space-6);

  /* CRITICAL: prevent flex children from forcing overflow */
  min-width: 0;
}

/* Brand */
.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 1.6rem;
  font-weight: var(--font-weight-black);
  color: var(--color-text-heading);
  line-height: 1;
  white-space: nowrap;

  flex: 0 0 auto;
}

.brand-logo img {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  flex: 0 0 auto;
}

/* Center area must be shrinkable */
.header-center-area {
  flex: 1 1 auto;
  min-width: 0; /* CRITICAL */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Spacer */
.header-spacer {
  flex: 1 1 auto;
  min-width: 0;
}

/* Right controls */
.header-controls {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  height: 100%;
  flex: 0 0 auto;
  min-width: 0;
}

/* Icon button blocks (notifications, etc.) */
.header-notifications {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-text-main);
  transition: var(--transition);
  flex: 0 0 auto;
}

.header-notifications:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.header-notifications i { font-size: 1.4rem; }

/* Unread badge */
.notif-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--color-danger);
  color: #fff;
  font-weight: var(--font-weight-black);
  font-size: 0.75rem;
  line-height: 20px;
  text-align: center;
  border: 2px solid #fff;
  box-shadow: 0 8px 16px rgba(0,0,0,0.12);
}

/* User dropdown area (keep shrink safe) */
.header-user-dropdown {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  min-width: 0;
}

.header-user-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 4px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  min-width: 0;
}

.header-username {
  font-weight: var(--font-weight-bold);
  font-size: 0.9rem;
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Avatar in header */
.header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--color-primary-soft);
  border: 1px solid var(--color-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Burger */
.burger-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-main);
  transition: var(--transition);
  flex: 0 0 auto;
}
.burger-btn:hover {
  background: #F3F4F6;
  color: var(--color-primary);
}
.burger-btn i { font-size: 1.8rem; }

/* Mobile adjustments */
@media (max-width: 992px) {
  .header-username { display: none; }
}

@media (max-width: 576px) {
  .brand-logo { font-size: 1.4rem; }
  .brand-logo img { width: 32px; height: 32px; }

  .header-inner { gap: var(--space-3); }

  /* If center area contains big search, let it shrink properly */
  .header-center-area { justify-content: flex-start; }

  .burger-btn i { font-size: 1.6rem; }
}   