@layer components {
  .header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    box-sizing: border-box;
    position: relative;

    & .logo--text {
      font-family: 'Graphik', sans-serif;
      font-size: 1.125rem;
      font-weight: 700;
      color: #111;
      text-decoration: none;

      flex-shrink: 0;
      display: flex;
      align-items: center;
      text-decoration: none;      
    }

    & .logo--squared-50,
    & .logo--svg {
      height: 44px;
      width: 44px;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      text-decoration: none;

      & svg { width: 44px; height: 44px; }
    }

    & .search--header {
      position: absolute;
      left: 50%;
      transform: translateX(-50%);
      width: 360px;
      padding: 0;

      & form { display: block; }

      & .search__field-wrapper {
        position: relative;
        display: flex;
        align-items: center;
      }

      & .search__icon {
        position: absolute;
        left: 13px;
        top: 50%;
        transform: translateY(-50%);
        pointer-events: none;
        display: flex;
        align-items: center;
        & svg { width: 16px; height: 16px; fill: #9aa0a6; }
      }

      & .search__input {
        width: 100%;
        height: 50px;
        line-height: 50px;
        border: 1px solid #dfe1e5;
        border-radius: 25px;
        background: #ffffff;
        padding: 0 1rem 0 42px;
        font-size: 1rem;
        font-weight: 400;
        color: #202124;
        box-sizing: border-box;
        transition: box-shadow 0.1s ease;

        &::placeholder { color: #9aa0a6; }
        &:hover { box-shadow: 0 1px 6px rgba(32,33,36,.28); border-color: transparent; }
        &:focus { outline: none; box-shadow: 0 1px 6px rgba(32,33,36,.28); border-color: transparent; }
      }

      & .search__loading { display: none; }
    }

    & .nav--on-right,
    & .header-menu {
      margin-left: auto;
      display: flex;
      align-items: center;
      gap: 1rem;

      & .header-menu__item { margin: 0; }
    }

    & .header__user {
      margin-left: auto;
      display: flex;
      align-items: center;
      gap: 0.25rem;
    }
  }

  .body--mobile .header {
    gap: 0.625rem;
    padding: 0 var(--spacing-md);

    & .search--header {
      position: static;
      left: auto;
      transform: none;
      flex: 1;
      width: auto;
      max-width: none;
      & .search__input { min-width: 0; }
    }

    & .view-toggle {
      position: absolute;
      left: 50%;
      transform: translateX(-50%);
    }
  }

  .hdr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 50px;
    border: none;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    border-radius: 25px;
    padding: 0 24px;
    transition: background 0.12s ease, color 0.12s ease;
    flex-shrink: 0;

    & svg { width: 14px; height: 14px; }
  }

  .hdr-btn--icon {
    width: 50px;
    padding: 0;
    background: transparent;
    color: #9ca3af;
    border-radius: 12px;

    &:hover { background: #f5f3ef; color: #374151; }
    & svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  }

  .hdr-btn--ghost {
    background: transparent;
    color: #6b7280;
    padding: 0 10px;

    & svg { fill: #6b7280; }
    &:hover { background: #f5f3ef; color: #374151; }
  }

  .hdr-btn--secondary {
    background: #f5f3ef;
    color: #374151;

    & svg { fill: #374151; }
    &:hover { background: #ece8e1; }
  }

  .hdr-btn--primary {
    background: #ff2800;
    color: #ffffff;

    & svg { fill: #ffffff; }
    &:hover { background: #e52400; color: #ffffff; }
    &:visited { color: #ffffff; }
  }

  .user-menu__trigger {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-radius: 50%;

    &:hover { opacity: 0.85; }
  }

  .user-menu__avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
  }

  .user-menu__avatar--default {
    & svg { width: 50px; height: 50px; }
  }

  [data-theme="dark"] .header .search__input {
    background:
      linear-gradient(#1e293b, #1e293b) padding-box,
      linear-gradient(90deg, #4285F4, #EA4335, #FBBC05, #34A853) border-box;
    border: 2px solid transparent;
    color: #e8eaed;

    &::placeholder { color: #9aa0a6; }
    &:hover, &:focus { box-shadow: 0 1px 8px rgba(66, 133, 244, 0.3); }
  }

  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .header .search__input {
      /* background:
        linear-gradient(#1e293b, #1e293b) padding-box,
        linear-gradient(90deg, #4285F4, #EA4335, #FBBC05, #34A853) border-box; */
      /* border: 2px solid transparent; */
      border-color: light-dark(rgb(118, 118, 118), rgb(133, 133, 133));
      background-color: transparent;
      color: #e8eaed;

      &::placeholder { color: #9aa0a6; }
      &:hover, &:focus { box-shadow: 0 1px 8px rgba(66, 133, 244, 0.3); }
    }
  }
}
