/* SeedQuest contrast compatibility layer.
 * Loaded after the legacy and branded skins so interactive controls remain
 * readable when they are nested inside colored legacy components. */

/* Use darker action gradients that keep white labels above WCAG AA contrast. */
.btn-primary {
    background: linear-gradient(135deg, #1d4ed8, #1e40af) !important;
}

.btn-success {
    background: linear-gradient(135deg, #047857, #065f46) !important;
}

.btn-info,
#navbar_lists,
#navbar_datasets {
    background: linear-gradient(135deg, #0e7490, #155e75) !important;
}

.btn-warning {
    background: linear-gradient(135deg, #b45309, #92400e) !important;
}

.btn-danger {
    background: linear-gradient(135deg, #b91c1c, #991b1b) !important;
}

.btn-default,
.btn-default:link,
.btn-default:visited,
.btn-default:active {
    background: linear-gradient(135deg, #fff, #e2e8f0) !important;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
    text-shadow: none !important;
}

.btn-default:hover,
.btn-default:focus {
    background: #cbd5e1 !important;
    color: #0f172a !important;
}

/* Disabled controls stay visibly inactive without making their labels vanish. */
.btn.disabled,
.btn[disabled],
fieldset[disabled] .btn {
    background: #e2e8f0 !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: none !important;
    color: #475569 !important;
    cursor: not-allowed !important;
    opacity: 1 !important;
    text-shadow: none !important;
}

/* The branded skin makes every info-header descendant white. Restore dark
 * labels on light default buttons while retaining white header text. */
.infosectionhead .btn-default,
.infosectionhead_empty .btn-default,
.sub_infosectionhead .btn-default,
.sub_infosectionhead_empty .btn-default,
.infosectionhead a.btn-default:link,
.infosectionhead_empty a.btn-default:link,
.sub_infosectionhead a.btn-default:link,
.sub_infosectionhead_empty a.btn-default:link,
.infosectionhead a.btn-default:visited,
.infosectionhead_empty a.btn-default:visited,
.sub_infosectionhead a.btn-default:visited,
.sub_infosectionhead_empty a.btn-default:visited {
    background: linear-gradient(135deg, #fff, #e2e8f0) !important;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
    text-decoration: none !important;
    text-shadow: none !important;
}

.infosectionhead,
.infosectionhead_empty,
.sub_infosectionhead,
.sub_infosectionhead_empty {
    background: linear-gradient(135deg, #1d4ed8, #1e40af) !important;
}

.infosectionhead .btn-default:hover,
.infosectionhead_empty .btn-default:hover,
.sub_infosectionhead .btn-default:hover,
.sub_infosectionhead_empty .btn-default:hover {
    background: #cbd5e1 !important;
    color: #0f172a !important;
}

.infosectionhead .btn-default.disabled,
.infosectionhead .btn-default[disabled],
.infosectionhead_empty .btn-default.disabled,
.infosectionhead_empty .btn-default[disabled],
.sub_infosectionhead .btn-default.disabled,
.sub_infosectionhead .btn-default[disabled],
.sub_infosectionhead_empty .btn-default.disabled,
.sub_infosectionhead_empty .btn-default[disabled] {
    background: #e2e8f0 !important;
    color: #475569 !important;
}

/* Darker legacy section colors preserve the visual grouping and white text. */
.infosectionhead:nth-of-type(4n+1),
table.infosectionhead:nth-of-type(4n+1) {
    background: linear-gradient(135deg, #1d4ed8, #1e40af) !important;
}

.infosectionhead:nth-of-type(4n+2),
table.infosectionhead:nth-of-type(4n+2) {
    background: linear-gradient(135deg, #047857, #065f46) !important;
}

.infosectionhead:nth-of-type(4n+3),
table.infosectionhead:nth-of-type(4n+3) {
    background: linear-gradient(135deg, #6d28d9, #5b21b6) !important;
}

.infosectionhead:nth-of-type(4n+4),
table.infosectionhead:nth-of-type(4n+4) {
    background: linear-gradient(135deg, #b45309, #92400e) !important;
}

/* Search mode buttons used cyan backgrounds that were too light for white. */
button.modesel {
    background: #0e7490 !important;
    border-color: #155e75 !important;
    color: #fff !important;
}

button.modesel:hover,
button.modesel:focus {
    background: #155e75 !important;
    color: #fff !important;
}

button.modesel_hi {
    background: #1d4ed8 !important;
    border-color: #1e40af !important;
    color: #fff !important;
}

/* Bootstrap panel headings use light fills, so dark text is clearer than white. */
.panel-default > .panel-heading {
    color: #1e40af !important;
}

.panel-primary > .panel-heading {
    color: #0c4a6e !important;
}

.panel-success > .panel-heading {
    color: #064e3b !important;
}

.panel-info > .panel-heading {
    color: #164e63 !important;
}

.panel-warning > .panel-heading {
    color: #713f12 !important;
}

.panel-danger > .panel-heading {
    color: #7f1d1d !important;
}

/* Active tabs need a darker blue behind white labels. */
.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
    background: linear-gradient(135deg, #1d4ed8, #1e40af) !important;
    color: #fff !important;
}

/* Dashboard hero cards and secondary descriptions. */
.sq-card--trials {
    background: linear-gradient(135deg, #b45309, #92400e) !important;
}

.sq-card--weather {
    background: linear-gradient(135deg, #0e7490, #155e75) !important;
}

.sq-card--qc {
    background: linear-gradient(135deg, #b91c1c, #991b1b) !important;
}

.sq-link-text p,
.sq-qc-subtext,
#sq-solvi-empty {
    color: #64748b !important;
}

.sq-qc-hero .sq-qc-eyebrow {
    opacity: 1 !important;
}

/* Keep the complete QC workflow legible across the whole hero gradient. */
.sq-qc-hero {
    background: linear-gradient(135deg, #7f1d1d 0%, #b91c1c 52%, #9a3412 100%) !important;
}

.sq-qc-hero p {
    color: #fff !important;
}

.sq-qc-status--not_started,
.sq-qc-status--revoked,
.sq-qc-status--cancelled,
.sq-qc-status--superseded {
    color: #475569 !important;
}

/* Treatment helper copy is small, so use a stronger muted tone. */
.sq-treatments {
    --sq-treatment-muted: #4f625a;
}

.sq-treatments .text-muted {
    color: #5f6b66 !important;
}

/* Solvi uses compact supporting copy, so it needs a darker muted tone. */
.sq-solvi-loading,
.sq-solvi-metric span,
.sq-solvi-toolbar p,
.sq-solvi-panel-head p,
.sq-solvi-subtext,
.sq-solvi-audit-item span {
    color: #526d82 !important;
}

.sq-solvi-status--ready { color: #92400e !important; }
.sq-solvi-status--approved { color: #5b21b6 !important; }
.sq-solvi-status--importing { color: #075985 !important; }
.sq-solvi-status--imported { color: #065f46 !important; }

#export-full-jpg-btn {
    background: #047857 !important;
}

/* Placeholder text remains distinguishable from entered values but readable. */
.select2-selection__placeholder,
input::placeholder,
textarea::placeholder {
    color: #64748b !important;
    opacity: 1 !important;
}

select,
option,
.form-control[disabled],
.form-control[readonly],
select[disabled] {
    color: #334155 !important;
    opacity: 1 !important;
}

/* Footer metadata is secondary, but it still needs normal-text contrast. */
.sq-footer-links,
.sq-footer-links a,
.sq-sep,
.sq-muted,
.sq-footer-version a {
    color: #64748b !important;
}

/* Location markers use dark labels on light pins and outlined white labels on
 * dark pins. The classes are generated by location_map.mas. */
.sq-location-marker-label {
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.05;
    position: relative;
    text-shadow: 0 1px 2px #000, 0 0 2px #000;
    top: 50%;
    transform: translateY(-50%);
}

.sq-location-marker-label--dark {
    color: #172033;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.85);
}

@media (max-width: 768px) {
    /* Legacy sections combine width:100% with symmetric desktop margins,
     * which adds a few pixels of page-level horizontal scrolling on phones. */
    .infosectioncontent,
    .infosectioncontent_empty {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}
