/* Multiple brands: profile library (profile.php#branding) and the shared brand
   selector (php/partials/brand-selector.php) used by /generate, the collection
   form and the batch modal. Bound by assets/javascript/brands.js. Colours come
   from _brand.css variables only. */

.brands [hidden],
.brand-selector [hidden] {
    display: none !important;
}

/* ── Library head: counter + add button ─────────────────────────────────── */
.brands__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 0 12px;
}

.brands__count {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--tb-text-muted);
}

.brands__count.is-full {
    color: var(--tb-accent-text);
}

/* ── Brand list (compact rows) ──────────────────────────────────────────── */
.brands__list {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    display: grid;
    gap: 6px;
}

.brands__item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--landing-border);
    border-radius: 12px;
    background: var(--tb-surface);
    color: var(--tb-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.brands__item:hover {
    border-color: var(--landing-border-strong);
}

.brands__item[aria-pressed="true"] {
    border-color: var(--tb-primary);
    background: var(--tb-bg-soft);
}

.brands__item:focus-visible {
    outline: 2px solid var(--tb-focus);
    outline-offset: 2px;
}

.brands__thumb {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--tb-bg-soft);
    border: 1px solid var(--landing-border);
}

.brands__thumb--empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--tb-text-muted);
    font-size: 0.8rem;
    font-weight: 800;
}

.brands__name {
    flex: 1;
    min-width: 0;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brands__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.brands__badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--tb-text-muted);
    background: var(--tb-bg-soft);
    border: 1px solid var(--landing-border);
}

.brands__badge--default {
    color: var(--tb-primary);
    border-color: var(--tb-primary);
    background: var(--tb-surface);
}

.brands__badge--ok {
    color: var(--tb-primary);
}

.brands__badge--archived {
    color: var(--tb-accent-text);
}

.brands__empty {
    margin: 0 0 12px;
    padding: 14px;
    border: 1px dashed var(--landing-border-strong);
    border-radius: 12px;
    color: var(--tb-text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ── Selected brand editor ──────────────────────────────────────────────── */
.brands__editor {
    border-top: 1px solid var(--landing-border);
    padding-top: 14px;
}

.brands__editor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0 0 6px;
}

.brands__editor-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--tb-text);
    overflow-wrap: anywhere;
}

.brands__actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.brands__action {
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid var(--landing-border);
    background: var(--tb-surface);
    color: var(--tb-primary);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.brands__action:hover:not(:disabled) {
    background: var(--tb-bg-soft);
}

.brands__action:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.brands__action--danger {
    color: var(--tb-accent-text);
}

.brands__section {
    margin-top: 16px;
    padding: 14px;
    border: 1px solid var(--landing-border);
    border-radius: 16px;
    background: var(--tb-surface);
}

.brands__section-title {
    margin: 0 0 4px;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--tb-text);
}

.brands__section-hint {
    margin: 0 0 12px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--tb-text-muted);
}

.brands__notice {
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--tb-bg-soft);
    border: 1px solid var(--landing-border);
    color: var(--tb-text);
    font-size: 0.88rem;
    line-height: 1.5;
}

.brands__notice--warn {
    border-color: var(--tb-accent-soft);
}

.brands__notice-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.brands__msg {
    margin: 10px 0 0;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--tb-text);
}

.brands__msg.is-error {
    color: var(--tb-accent-text);
    font-weight: 600;
}

/* Modal (add / rename) reuses .dashboard-modal chrome from dashboard.css. */
.brands-modal__form {
    display: grid;
    gap: 12px;
}

.brands-modal__actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* ── Shared selector (generators) ───────────────────────────────────────── */
.brand-selector {
    display: grid;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--landing-border);
    border-radius: 14px;
    background: var(--tb-bg-soft);
    min-width: 0;
}

.brand-selector__label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--tb-text);
    margin: 0 0 4px;
}

.brand-selector__select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--landing-border-strong);
    border-radius: 10px;
    background: var(--tb-surface);
    color: var(--tb-text);
    font: inherit;
    font-weight: 600;
}

.brand-selector__select:focus-visible {
    outline: 2px solid var(--tb-focus);
    outline-offset: 1px;
}

.brand-selector__preview {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-size: 0.85rem;
    color: var(--tb-text-muted);
}

.brand-selector__preview img {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    object-fit: cover;
    border: 1px solid var(--landing-border);
    background: var(--tb-surface);
}

.brand-selector__preview-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-selector__option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--tb-text);
    cursor: pointer;
}

.brand-selector__option input {
    margin-top: 3px;
    flex: 0 0 auto;
    accent-color: var(--tb-primary);
}

.brand-selector__option input:disabled + span {
    color: var(--tb-text-muted);
}

.brand-selector__option-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.brand-selector__hint {
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.45;
    color: var(--tb-text-muted);
    overflow-wrap: anywhere;
}

.brand-selector__hint.is-quota-short {
    color: var(--tb-accent-text);
    font-weight: 700;
}

.brand-selector__hint a,
.brand-selector__manage {
    color: var(--tb-primary);
    font-weight: 600;
    text-decoration: underline;
}

.brand-selector__summary {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--tb-text);
}

.brand-selector__print-preview { display: grid; gap: 6px; min-width: 0; }
.brand-selector__print-preview[hidden] { display: none; }
.brand-selector__print-design {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--landing-border);
    border-radius: 12px;
    background: var(--tb-bg);
    color: var(--tb-dark);
    text-align: center;
    overflow-wrap: anywhere;
    font-weight: 700;
}
.brand-selector__print-design img { max-width: 100%; width: auto; height: 56px; object-fit: contain; }

.brand-selector__manage {
    font-size: 0.82rem;
    justify-self: start;
}

/* /generate keeps the preview and the summary side by side down to phone
   widths (generate.css); the selector tightens up in that narrow column. */
@media (max-width: 560px) {
    .generate-summary .brand-selector {
        padding: 8px 10px;
        gap: 8px;
    }

    .generate-summary .brand-selector__select {
        padding: 7px 8px;
        font-size: 0.85rem;
    }

    .generate-summary .brand-selector__option {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .brands__item {
        flex-wrap: wrap;
    }

    .brands__meta {
        width: 100%;
        justify-content: flex-start;
    }
}
