/* corpus-search.css */

code, kbd, pre, samp {
    font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}

code {
    padding: 2px 4px;
    font-size: 90%;
    color: #c7254e;
    background-color: #f9f2f4;
    border-radius: 3px;
}

kbd {
    padding: 2px 4px;
    font-size: 90%;
    color: #fff;
    background-color: #333;
    border-radius: 3px;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25);
}

pre {
    display: block;
    padding: 8px;
    margin: 0 0 8px;
    font-size: 13px;
    line-height: 1.42857143;
    color: #333;
    word-break: break-all;
    word-wrap: break-word;
    background-color: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 4px;
    white-space: pre-wrap;
}

pre code {
    padding: 0;
    font-size: inherit;
    color: inherit;
    background-color: transparent;
    border-radius: 0;
}

.pre-scrollable {
    max-height: 340px;
    overflow-y: scroll;
}

.redRing {
    border: 4px solid red;
}

.results {
    margin-top: 20px;
}

.submit_btn,
.reset_btn,
.results_btn,
.oink_btn {
    margin-right: 20px;
}

.hidden {
    visibility: hidden;
}

.processing {
    color: #990000;
}

#frm-files {
    height: 260px;
}

input:disabled {
    background-color: #fefefe;
    color: #a0a0a0;
}

optgroup {
    margin-bottom: 12px;
}

.btn:focus,
select:focus,
textarea:focus,
input:focus {
    outline: 4px solid #006298;
    outline-offset: 2px;
}

.nlq-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nlq-row .rvt-text-input {
    flex: 1;
}

.nlq-explanation {
    margin-top: 0.375rem;
    font-style: italic;
}

.translate_btn:disabled {
    opacity: 0.65;
    cursor: wait;
}

/* ── Form validation ───────────────────────────────────────────────────────── */

/* Red left-bordered error strip inserted beneath an invalid field by JS */
.cs-field-error {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin: 0.375rem 0 0;
    padding: 0.375rem 0.625rem;
    font-size: 0.875rem;
    color: #b91c1c;
    background: #fef2f2;
    border-left: 3px solid #ef4444;
    border-radius: 0 3px 3px 0;
}

/* Small warning triangle before the error message */
.cs-field-error::before {
    content: '';
    display: inline-block;
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    background-color: #b91c1c;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1zm-.75 4.25a.75.75 0 0 1 1.5 0v3.5a.75.75 0 0 1-1.5 0v-3.5zm.75 6.5a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1zm-.75 4.25a.75.75 0 0 1 1.5 0v3.5a.75.75 0 0 1-1.5 0v-3.5zm.75 6.5a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5z'/%3E%3C/svg%3E");
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

/* Red ring + subtle glow on fields that fail validation */
.cs-field-invalid,
.cs-field-invalid:focus {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18) !important;
    outline-color: #b91c1c !important;
}

/* ── Results-ready button states ────────────────────────────────────────────── */

/* "Show Results" button — IU blue filled when results are available */
.cs-btn-ready {
    background-color: #006298 !important;
    border-color: #006298 !important;
    color: #fff !important;
}
.cs-btn-ready:hover,
.cs-btn-ready:focus {
    background-color: #00507c !important;
    border-color: #00507c !important;
    color: #fff !important;
}

/* Checkmark icon inside the ready button */
.cs-btn-ready__icon {
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.3125rem;
    margin-top: -0.125rem;
}

/* "Download Results" button — blue outline to match */
.cs-btn-download-ready {
    border-color: #006298 !important;
    color: #006298 !important;
}
.cs-btn-download-ready:hover,
.cs-btn-download-ready:focus {
    background-color: #f0f7fc !important;
}

/* "Search complete" notice above the button group */
.cs-ready-notice {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #006298;
    font-weight: 500;
    margin-bottom: 0.625rem;
}

/* Pulsing dot in the notice */
.cs-ready-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #006298;
    flex-shrink: 0;
    animation: csReadyPulse 2.4s ease-in-out infinite;
}
@keyframes csReadyPulse {
    0%, 100% { opacity: 1;   transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(0.75); }
}

/* ── Search result cards ───────────────────────────────────────────────────── */

.cs-results {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

/* Query metadata strip */
.cs-preface {
    background: #fff8f8;
    border-left: 3px solid #990000;
    padding: 0.625rem 0.875rem;
    border-radius: 0 4px 4px 0;
    display: flex;
    flex-direction: column;
    gap: 0.3125rem;
    margin-bottom: 0.25rem;
}
.cs-preface__row {
    display: flex;
    align-items: baseline;
    gap: 0.625rem;
    flex-wrap: wrap;
}
.cs-preface__label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #777;
    min-width: 5.5rem;
    flex-shrink: 0;
}
.cs-preface__query {
    font-size: 0.8125rem;
    color: #222;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    white-space: pre-wrap;
    word-break: break-word;
}
.cs-preface__val {
    font-size: 0.875rem;
    color: #555;
}

/* Individual result card */
.cs-card {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #fff;
    overflow: hidden;
}
.cs-card__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 0.3125rem 0.875rem;
    background: #f7f7f7;
    border-bottom: 1px solid #ececec;
}
.cs-card__num {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #990000;
}
.cs-card__id {
    font-size: 0.6875rem;
    font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;
    color: #888;
}
.cs-card__sentence {
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #1a1a1a;
    font-style: italic;
    border-bottom: 1px solid #f0f0f0;
}
.cs-card__match {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.375rem;
    padding: 0.3125rem 0.875rem;
    font-size: 0.8125rem;
    background: #f5f9ff;
    border-bottom: 1px solid #e5eef8;
}
.cs-match-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #555;
    flex-shrink: 0;
}
.cs-match-code {
    font-size: 0.8rem;
    color: #003366;
    background: transparent;
    padding: 0;
    font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Collapsible parse tree */
.cs-tree-details {
    border-top: none;
}
.cs-tree-summary {
    padding: 0.3125rem 0.875rem;
    font-size: 0.8125rem;
    color: #666;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    user-select: none;
}
.cs-tree-summary::-webkit-details-marker { display: none; }
.cs-tree-summary::before {
    content: '\25B6';  /* ▶ */
    font-size: 0.5rem;
    color: #aaa;
    transition: transform 0.12s ease;
}
details[open] > .cs-tree-summary::before {
    transform: rotate(90deg);
}
.cs-tree-wrap {
    overflow-x: auto;
    border-top: 1px solid #ececec;
}
.cs-tree {
    margin: 0;
    padding: 0.75rem 1rem;
    background: #f5f5f5;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #333;
    border: none;
    border-radius: 0;
    white-space: pre;
    word-break: normal;
    word-wrap: normal;
}

/* Empty state */
.cs-no-results {
    padding: 2rem;
    text-align: center;
    color: #888;
    border: 1px dashed #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

/* Stats footer */
.cs-stats {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
    padding: 0.625rem 0.25rem;
    border-top: 2px solid #dee2e6;
    margin-top: 0.25rem;
    font-size: 0.875rem;
}
.cs-stats__label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #777;
    margin-right: 0.25rem;
}
.cs-stats__item {
    font-variant-numeric: tabular-nums;
    color: #333;
}
.cs-stats__sep {
    color: #ccc;
}
