/* SnapAdmin — theme-agnostic admin styles.

   Loaded on every SnapModel admin page, whichever theme is active. It must
   therefore contain only rules that are safe next to a themed admin: shared
   design tokens, SnapAdmin's own widgets, and cosmetics that no theme owns.

   The opinionated *layout* rewrite (labels above fields, forced field widths,
   uniform input padding) lives in `admin-stock.css` and is loaded ONLY when
   django-unfold is absent. It exists because Django's built-in admin has no
   modern form layout — but applying it on top of a theme actively breaks that
   theme, which is exactly what used to happen here: the rules were written
   against a `.unfold` body class that current Unfold no longer emits, so the
   copies in `admin-unfold.css` were dead while the unscoped originals in this
   file were fighting Unfold's own two-column rows, its `max-w-2xl` field
   widths and the `pr-8` gutter its select chevron sits in.

   Rule of thumb for this file: no `!important` layout, nothing that assumes
   Django's stock admin markup, nothing a theme would reasonably style itself. */

:root {
    --primary-color: #0c4b33;
    --accent-bg: rgba(100, 100, 100, 0.08);
    --border-light: rgba(0, 0, 0, 0.1);
    --radius: 6px;
    --transition: all 0.2s ease;
}

.faded-zeros {
    opacity: 0.3;
}

/* SnapAdmin's monospace primary-key badge in list views. */
th.field-formatted_id a,
td.field-formatted_id a {
    display: inline-block;
    padding: 3px 8px;
    background: var(--accent-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    text-decoration: none;
    font-family: monospace;
    font-weight: 600;
    color: #444;
    transition: var(--transition);
}

th.field-formatted_id a:hover,
td.field-formatted_id a:hover {
    background: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Whole changelist rows are clickable (see snapadmin/js/admin.js). */
#changelist-form table tbody tr {
    cursor: pointer;
}

.results table tr {
    transition: var(--transition);
}

.results table tr:hover {
    background-color: rgba(0, 0, 0, 0.03) !important;
}

/* ── Select2 ───────────────────────────────────────────────────────────────
   SnapAdmin vendors Select2 for its own widgets, so its legibility fixes
   belong here rather than in a theme layer. Only colours and sizing of the
   dropdown are touched — never the arrow, which each theme draws itself. */

.django-select2-container,
.select2-container--default,
.select2-container {
    max-width: 100%;
}

.select2-container--admin-autocomplete {
    min-width: 100%;
    width: 100%;
}

.select2-container--default .select2-selection--single,
.django-select2-container .select2-selection--single {
    height: 38px;
    border: 1px solid #d1d5db;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
}

/* The default theme sets white text on the highlighted option but the blue
   background was overridden, leaving white on light grey. Give the highlighted
   and selected options a solid background so they stay legible. */
.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted {
    background-color: var(--primary-color) !important;
    color: #fff !important;
}

.select2-container--default .select2-results__option[aria-selected="true"]:not(.select2-results__option--highlighted) {
    background-color: var(--accent-bg) !important;
    color: #333 !important;
}

.select2-container--default .select2-results__option {
    color: #333 !important;
}

.select2-selection__rendered {
    padding-left: 12px;
    color: #333;
}

/* ── CKEditor 5 (optional [wysiwyg] extra) ─────────────────────────────────
   No admin theme styles the editor shell, so sizing it is ours in both modes. */

.ck-editor {
    width: 100%;
    max-width: 100%;
}

.ck-content {
    min-height: 200px;
}

/* ── Horizontal field rows (SnapField `row="..."`) ─────────────────────────
   `div.fields` is Django's stock fieldset markup; themes with their own row
   layout (Unfold) never emit it, so this is inert there rather than fighting. */

.snap-field-row > div.fields {
    display: flex;
    flex-direction: row;
    gap: 20px;
    flex-wrap: wrap;
    align-items: flex-end;
    width: 100%;
}

.snap-field-row > div.fields > div {
    flex: 1;
    min-width: 150px;
    max-width: 100%;
    border-bottom: none;
    margin: 0;
    padding: 0;
}
