/*
 * Shared admin control primitives.
 * Components use these classes instead of restyling buttons, fields and status pills locally,
 * so nested editors never fall back to browser-default controls or a second visual language.
 */

.ops-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--ops-space-2);
    min-height: var(--ops-control-height);
    padding: 0 var(--ops-space-4);
    border: 1px solid var(--ops-border-strong);
    border-radius: var(--ops-radius-control);
    color: var(--ops-text);
    background: var(--ops-card);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.ops-button:hover:not(:disabled):not([aria-disabled="true"]) {
    border-color: rgba(0, 122, 255, 0.44);
    background: var(--ops-surface-raised);
    text-decoration: none;
}

.ops-button:focus-visible {
    outline: 3px solid var(--ops-focus);
    outline-offset: 2px;
}

.ops-button--primary {
    border-color: var(--ops-accent-strong);
    color: #fff;
    background: var(--ops-accent-strong);
}

.ops-button--primary:hover:not(:disabled):not([aria-disabled="true"]) {
    border-color: var(--ops-accent-hover);
    color: #fff;
    background: var(--ops-accent-hover);
}

.ops-button--danger {
    border-color: rgba(180, 35, 24, 0.34);
    color: var(--ops-danger);
}

.ops-button--danger:hover:not(:disabled):not([aria-disabled="true"]) {
    border-color: var(--ops-danger);
    background: #fff5f4;
}

.ops-button--danger-filled {
    border-color: var(--ops-danger);
    color: #fff;
    background: var(--ops-danger);
}

.ops-button--danger-filled:hover:not(:disabled):not([aria-disabled="true"]) {
    border-color: #912018;
    color: #fff;
    background: #912018;
}

.ops-button--quiet {
    padding-inline: var(--ops-space-3);
    border-color: transparent;
    color: var(--ops-accent-text);
    background: transparent;
}

.ops-button--quiet:hover:not(:disabled):not([aria-disabled="true"]) {
    border-color: transparent;
    background: var(--ops-accent-soft);
}

.ops-button--small {
    min-height: 32px;
    padding: 0 var(--ops-space-3);
    border-radius: var(--ops-radius-small);
    font-size: 12px;
}

.ops-button-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--ops-space-2);
}

/* Field: a label stacked above a full-width control. */
.ops-field {
    display: grid;
    align-content: start;
    gap: 6px;
    min-width: 0;
}

.ops-field > span:first-child,
.ops-field-label {
    color: var(--ops-text);
    font-size: 13px;
    font-weight: 600;
}

.ops-field :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
    width: 100%;
    min-width: 0;
    padding: 0 var(--ops-space-3);
}

.ops-field small {
    color: var(--ops-muted);
    font-size: 12px;
    line-height: 1.4;
}

.ops-field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
    gap: var(--ops-space-3);
}

/* Status pill: non-interactive state label. */
.ops-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    color: #34465a;
    background: #eef2f6;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.ops-pill--success {
    color: #0b6b38;
    background: #e3f6ea;
}

.ops-pill--accent {
    color: var(--ops-accent-text);
    background: var(--ops-accent-soft);
}

.ops-pill--warning {
    color: #7b4b00;
    background: #fff1c7;
}

.ops-pill--danger {
    color: #8f2118;
    background: #ffe7e4;
}

/* Card: bordered admin surface with the standard content padding. */
.ops-card {
    display: grid;
    align-content: start;
    gap: var(--ops-space-4);
    min-width: 0;
    padding: var(--ops-space-5) var(--ops-space-6);
    border: 1px solid var(--ops-border);
    border-radius: var(--ops-radius-card);
    background: var(--ops-card);
    box-shadow: var(--ops-shadow-soft);
}

.ops-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--ops-space-4);
    min-width: 0;
}

.ops-card-header > div {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.ops-card-header h2,
.ops-card-header h3 {
    margin: 0;
    color: var(--ops-text);
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
}

.ops-card-header p,
.ops-card-text {
    margin: 0;
    color: var(--ops-muted);
    font-size: 13px;
    line-height: 1.5;
}

/*
 * Safety net: an admin button without any class must never keep the browser-default look.
 * Zero specificity, so every component rule still wins.
 */
:where(.ops-content) :where(button:not([class])) {
    padding: 8px 14px;
    border: 1px solid var(--ops-border-strong);
    border-radius: var(--ops-radius-small);
    color: var(--ops-text);
    background: var(--ops-card);
    font-weight: 600;
    cursor: pointer;
}
