/*
 * Bug reports (module bugs, assets/js/bugs.js; Spectrum's look, its app.css / sing.css rules that GreenSing did not have):
 * the footer's open counts for the holders, the report window (form.php), one report's window (report.php: Spectrum's
 * window parts .cw-* and .vz-sec) and its conversation. Loaded after app.css (head.php); the colours are app.css tokens.
 */

/* the bug reports' open counts (footer.php, bugs.js): a box with the buttons' corners, a count per state, a line between */
.footko .foot-bugs {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 10px;
    height: 28px;
    margin-left: .75rem;
    padding: 0 12px 0 10px;
    border-radius: 8px;
    background: var(--sp-soft-bg);
    color: var(--sp-soft-fg);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
}

.footko .foot-bugs:hover {
    background: var(--sp-rail-hover-bg);
}

.foot-bugs-new,
.foot-bugs-progress {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.foot-bugs-new:not(.d-none) + .foot-bugs-progress {
    padding-left: 10px;
    border-left: 1px solid var(--sp-line);
}

.foot-bugs .badge {
    min-width: 18px;
    padding: 3px 5px;
    border-radius: 5px;
    font-size: 11px;
}

/* the bug report window (form.php): kind tiles, plain labels, a drop area, Send at the bottom right */
.modal-body.bug-form {
    padding: 1rem 1.25rem 1.25rem !important;
}

.bug-form .form-group {
    margin-bottom: .9rem;
}

.bug-form label:not(.bug-type) {
    margin-bottom: .3rem;
    font-weight: 600;
}

.bug-types {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .5rem;
}

.bug-type {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    min-height: 4.5rem;
    margin: 0;
    padding: .6rem .4rem;
    border: 1px solid var(--sp-line);
    border-radius: .5rem;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    user-select: none;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}

.bug-type input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.bug-type > i {
    font-size: 1.4rem;
}

.bug-type:hover {
    border-color: var(--bs-primary);
}

.bug-type.is-active {
    border-color: var(--bs-primary);
    box-shadow: inset 0 0 0 1px var(--bs-primary);
    background-color: var(--sp-soft-bg);
}

.bug-type:has(input:focus-visible) {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* the client of a client problem: the search's results under the field, then the chosen one */
.bug-client-list {
    position: absolute;
    z-index: 5;
    right: 0;
    left: 0;
    max-height: 16rem;
    overflow-y: auto;
    box-shadow: var(--sp-shadow);
}

.bug-client-chosen {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin-top: .4rem;
    padding: .4rem .6rem;
    border-radius: .3rem;
    background-color: var(--sp-info-bg);
}

.bug-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
    padding: 1.1rem .75rem;
    border: 2px dashed var(--sp-line);
    border-radius: .5rem;
    color: var(--sp-muted);
    font-size: .875rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background-color .15s;
}

.bug-drop > i {
    font-size: 1.6rem;
    opacity: .7;
}

.bug-drop:hover,
.bug-drop:focus,
.bug-drop.is-over {
    border-color: var(--bs-primary);
    background-color: var(--sp-soft-bg);
    outline: none;
}

.bug-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
}

.bug-thumbs:not(:empty) {
    margin-top: .6rem;
}

.bug-thumb {
    position: relative;
}

.bug-thumb img {
    height: 72px;
    border: 1px solid var(--sp-line);
    border-radius: .3rem;
}

.bug-thumb .bugThumbDel,
.bug-thumb .bugCmtDel {
    position: absolute;
    top: -7px;
    right: -7px;
    border-radius: 50%;
    background: var(--sp-surface);
    color: var(--bs-danger);
    line-height: 1;
}

.bug-tech {
    margin-bottom: .5rem;
    font-size: .8rem;
}

.bug-tech summary {
    color: var(--sp-muted);
    cursor: pointer;
}

.bug-tech dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: .25rem .75rem;
    margin-top: .5rem;
    padding: .5rem .6rem;
    border-radius: .3rem;
    background-color: var(--sp-grey-bg);
}

.bug-tech dt {
    font-weight: 600;
}

.bug-tech dd {
    min-width: 0;
    margin: 0;
}

.bug-tech pre {
    max-height: 10rem;
    margin: 0;
    overflow: auto;
    font-size: inherit;
    white-space: pre-wrap;
}

.bug-form-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem 1rem;
    margin-top: 1rem;
    padding: .75rem 0 .25rem;
    border-top: 1px solid var(--sp-line);
}

@media (max-width: 575.98px) {
    .bug-types {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .bug-tech dl {
        grid-template-columns: 1fr;
    }

    .bug-form-foot .bugSend {
        width: 100%;
    }
}

/* one report (report.php): Spectrum's window parts - a part with its title (.vz-sec), a field's quiet name, hints, the
   quoted text, the screenshots, the answer box, the script errors (.cw-*) - and the conversation under it */
#default-modal-lg .modal-dialog:has(.cw-lg) {
    max-width: min(1000px, calc(100vw - 1rem));
}

.modal-title.cw-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem .5rem;
}

.modal-title.cw-title > i:first-child {
    color: var(--sp-muted);
}

.modal-title.cw-title .wo-tag {
    font-size: .75rem;
}

.vz-sec {
    margin-bottom: .75rem;
    padding: .65rem .85rem .8rem;
    border: 1px solid var(--sp-line);
    border-radius: var(--sp-r-card);
    background: var(--sp-surface);
}

.cw-win .vz-sec:last-child {
    margin-bottom: 0;
}

.vz-sec-title {
    display: flex;
    align-items: center;
    gap: .45rem;
    width: 100%;
    margin: 0 0 .6rem;
    color: var(--sp-text);
    font-size: .9rem;
    font-weight: 700;
}

.vz-sec-title > i:first-child {
    color: var(--sp-muted);
}

.cw-win .form-group {
    margin-bottom: .6rem;
}

.cw-label {
    display: block;
    margin: 0 0 .2rem;
    color: var(--sp-muted);
    font-size: .72rem;
    font-weight: 600;
    line-height: 1.25;
}

.cw-hint {
    color: var(--sp-muted);
    font-size: .8rem;
}

.cw-win textarea.cw-text {
    min-height: 120px;
    resize: vertical;
}

.cw-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
    margin-bottom: .6rem;
}

.cw-win table.cw-table {
    margin-bottom: 0;
}

.cw-win table.cw-table th {
    color: var(--sp-muted);
    font-size: .75rem;
    font-weight: 600;
    text-align: left !important;
    white-space: nowrap;
}

.cw-win table.cw-table td {
    padding: 5px 8px !important;
    text-align: left;
    vertical-align: middle;
}

.cw-log {
    margin: 0;
    padding: .5rem .65rem;
    overflow: auto;
    border: 1px solid var(--sp-line);
    border-radius: 8px;
    background: var(--sp-soft-bg);
    color: var(--sp-text);
    font-size: .78rem;
    white-space: pre-wrap;
}

.cw-log.cw-log-sm {
    max-height: 12rem;
}

.cw-quote,
.cw-pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.cw-quote {
    padding: .55rem .75rem;
    border: 1px solid var(--sp-line);
    border-radius: 8px;
    background: var(--sp-surface);
}

.cw-shots {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.cw-shots img {
    height: 90px;
    min-width: 60px;
    border: 1px solid var(--sp-line);
    border-radius: 6px;
    background: var(--sp-soft-bg);
}

.cw-reply {
    padding: .5rem .75rem;
    border-left: 3px solid var(--bs-success);
    border-radius: 8px;
    background: var(--sp-ok-bg);
}

.cw-reply.cw-reply-off {
    border-left-color: var(--sp-line);
    background: var(--sp-grey-bg);
}

/* the conversation: the reporter's comments on the left, the holders' on the right (blue edge) */
.bug-thread {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.bug-cmt {
    max-width: 92%;
    padding: .45rem .7rem;
    border: 1px solid var(--sp-line);
    border-radius: 10px;
    background: var(--sp-surface);
}

.bug-cmt.is-staff {
    align-self: flex-end;
    border-color: transparent;
    border-left: 3px solid var(--bs-primary);
    background: var(--sp-soft-bg);
}

.bug-cmt .cw-shots img {
    height: 70px;
}

.bug-cmt-edit {
    margin-left: auto;
}

.bug-compose .cw-text,
.bug-edit-area {
    min-height: 120px;
}

/* the holders' page: the settings' part titles, a task's tag */
.co-sec-title {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin: .9rem 0 .4rem;
    font-size: .9rem;
    font-weight: 700;
}

.co-sec-title > i:first-child {
    color: var(--sp-muted);
}

.wo-tag-help {
    background: var(--sp-info-bg);
    color: var(--sp-info-fg);
}
