/* ===== Referências da encomenda (.ref-*) — Shared/Referencia/*.razor ===== */

.ref-editor {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ref-loading {
    align-items: center;
    display: flex;
    justify-content: center;
    padding: 16px 0;
}

.ref-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ref-item {
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    display: flex;
    gap: 6px;
    padding: 6px;
    position: relative;
}

.ref-item__thumb {
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    height: 64px;
    overflow: hidden;
    padding: 0;
    width: 64px;
}

.ref-item__thumb img {
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.ref-item__link {
    align-items: center;
    background: var(--bg-secondary, #f8f9fa);
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    font-size: 0.85rem;
    gap: 6px;
    max-width: 220px;
    padding: 10px 12px;
}

.ref-item__link span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ref-item__remove {
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    height: 22px;
    justify-content: center;
    position: absolute;
    right: -6px;
    top: -6px;
    width: 22px;
}

.ref-item__remove:hover {
    color: #ef4444;
}

.ref-add-btn {
    align-items: center;
    align-self: flex-start;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--primary);
    cursor: pointer;
    display: inline-flex;
    font-size: 0.85rem;
    font-weight: 600;
    gap: 6px;
    padding: 8px 14px;
    transition: border-color 0.12s ease, background 0.12s ease;
}

.ref-add-btn:hover {
    background: color-mix(in srgb, var(--primary) 8%, transparent);
    border-color: var(--primary);
}

.ref-vazio {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0;
}

/* Lista de referências: cabeçalho (desktop), miniatura, título, categoria, remover */
.ref-rows {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ref-rows__cab {
    background: color-mix(in srgb, var(--text-secondary) 8%, transparent);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: none;
    font-size: 0.72rem;
    font-weight: 700;
    gap: 12px;
    grid-template-columns: 1fr 76px 34px;
    letter-spacing: 0.04em;
    padding: 8px 12px;
    text-transform: uppercase;
}

.ref-rows__cab em {
    font-style: normal;
    font-weight: 600;
    letter-spacing: 0;
    opacity: 0.8;
}

@container layout (min-width: 641px) {
    .ref-rows__cab {
        display: grid;
    }
}

.ref-row {
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    padding: 10px 12px;
    transition: background 0.12s ease;
}

.ref-row:last-child {
    border-bottom: none;
}

.ref-row:nth-child(even) {
    background: color-mix(in srgb, var(--text-secondary) 4%, transparent);
}

.ref-row:hover {
    background: color-mix(in srgb, var(--primary) 7%, transparent);
}

.ref-row__sem-titulo {
    color: var(--text-secondary);
    font-style: italic;
    font-weight: 500 !important;
}

.ref-row__thumb {
    align-items: center;
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    border: none;
    border-radius: 8px;
    color: var(--primary);
    cursor: pointer;
    display: flex;
    flex-shrink: 0;
    font-size: 1.3rem;
    height: 48px;
    justify-content: center;
    overflow: hidden;
    padding: 0;
    width: 48px;
}

.ref-row__thumb img {
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.ref-row__texto {
    align-items: flex-start;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    justify-content: center;
    min-width: 0;
    padding: 0;
    text-align: left;
}

.ref-row__texto strong {
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ref-row__texto small {
    color: var(--text-secondary);
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ref-row__tipo {
    border-radius: 999px;
    flex-shrink: 0;
    text-align: center;
    width: 76px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
}

.ref-row__tipo--imagem {
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
}

.ref-row__tipo--link {
    background: rgba(139, 92, 246, 0.14);
    color: #7c3aed;
}

:root[data-theme="dark"] .ref-row__tipo--link {
    color: #c4b5fd;
}

.ref-row__remover {
    align-items: center;
    background: none;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    flex-shrink: 0;
    height: 34px;
    justify-content: center;
    width: 34px;
}

.ref-row__remover:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.ref-row__remover:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.ref-form {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
}

/* Seletor Imagem | Link (um ativo, outro apagado) */
.ref-switch {
    align-self: flex-start;
    background: color-mix(in srgb, var(--text-secondary) 12%, transparent);
    border-radius: 999px;
    display: inline-flex;
    padding: 3px;
}

.ref-switch__op {
    align-items: center;
    background: transparent;
    border: none;
    border-radius: 999px;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    font-size: 0.8rem;
    font-weight: 600;
    gap: 6px;
    padding: 6px 16px;
    transition: background 0.15s ease, color 0.15s ease;
}

.ref-switch__op--ativo {
    background: linear-gradient(135deg, #4d89ff 0%, #325bb3 100%);
    box-shadow: 0 2px 6px rgba(50, 91, 179, 0.3);
    color: #fff;
}

.ref-form__input {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.88rem;
    padding: 8px 10px;
    width: 100%;
}

.ref-filepicker {
    align-items: center;
    background: var(--card-bg);
    border: 1px dashed var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
    padding: 20px 12px;
    position: relative;
    text-align: center;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.ref-filepicker:hover {
    border-color: var(--primary);
}

.ref-filepicker__input {
    cursor: pointer;
    height: 100%;
    inset: 0;
    opacity: 0;
    position: absolute;
    width: 100%;
}

.ref-filepicker__icon {
    color: var(--text-secondary);
    font-size: 1.6rem;
}

.ref-filepicker__preview {
    border-radius: 8px;
    height: 64px;
    object-fit: cover;
    width: 64px;
}

.ref-filepicker__text {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.ref-form__erro {
    color: #ef4444;
    font-size: 0.8rem;
    margin: 0;
}

.ref-form__acoes {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

