/* The tabs a document list opens its toolbar with — the received
   documents' bills and bank statements: links drawn as one segmented
   control, the list it is on lifted onto the brand. */

@layer components {
  .doc-tabs {
    background: var(--color-surface);
    border: 1.5px solid var(--color-border-subtle);
    border-radius: var(--radius-lg);
    display: inline-flex;
    flex-shrink: 0;
    gap: 0.25rem;
    padding: 0.3rem;
  }

  .doc-tabs__tab {
    border-radius: var(--radius-md);
    color: var(--color-ink-secondary);
    font-size: 0.9375rem;
    font-weight: 600;
    padding: 0.5rem 1.125rem;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;

    &:hover {
      color: var(--color-brand);
    }

    &.is-current {
      background: var(--color-brand-fill);
      color: var(--color-ink-inverted);
    }
  }

  /* Draws the eye to the tab a row just left the list for — a bank statement
     uploaded among the bills, filed under its own tab once read. */
  .doc-tabs__tab--flash {
    animation: doc-tabs-tab-flash 1.4s ease-in-out;
  }

  /* Both pulses live in one run rather than two iterations, so the fade out of
     the first eases straight into the fade in of the second. */
  @keyframes doc-tabs-tab-flash {
    0%, 50%, 100% { background-color: transparent; color: var(--color-ink-secondary); }
    25%, 75% { background-color: var(--color-brand-tint); color: var(--color-brand); }
  }

  /* With tabs at the start of the toolbar, the filter's chips gather at its
     end, beside "Manage". A phone has no room for all three on one row: the
     tabs fill the first, evenly, and the filter and "Manage" share the one
     under them as they do on a list without tabs. */
  .invoices-toolbar:has(.doc-tabs) {
    gap: 1rem;

    .inv-filter {
      justify-content: flex-end;
    }

    @media (width < 768px) {
      .doc-tabs {
        display: flex;
        flex-basis: 100%;
      }

      .doc-tabs__tab {
        flex: 1;
        text-align: center;
      }

      .inv-filter {
        justify-content: flex-start;
      }
    }
  }
}
