/* comparator.css */
@import "./index.css";

/* Root container */
.comparator-widget {
    height: 660px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    font-family: "Euclid Circular A", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background-color: #f9fbfa;
    color: #001e2b;
    border-radius: 8px;
    border: 1px solid #e8edeb;
}

/* Main content: no vertical scroll here, only inside results-grid */
.comparator-widget .content-wrapper {
    flex: 1;
    overflow-y: hidden;
    min-height: 0;
    padding: 10px;
}

/* Dark theme */
.comparator-widget.dark-theme,
.comparator-widget.dark-theme .content-wrapper {
    background-color: #011e2b;
    color: #f9fafb;
}

.comparator-widget.dark-theme .content-wrapper {
    border-radius: 8px;
}

/* Settings panel: 3 columns: query | topK | button */
#vector-comparator #settings-section.comparator-settings {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 0.7fr) auto;
    column-gap: 1rem;
    row-gap: 0.5rem;
    align-items: end;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 1rem;
    background: #f9fbfa;
    border-radius: 8px;
    border: 1px solid #e8edeb;
}

.comparator-widget.dark-theme #settings-section.comparator-settings {
    background-color: #1c2d39;
    border: 1px solid #3d4f58;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

.control-group label {
    display: block;
    font-weight: 700;
    text-transform: uppercase;
    color: #889397;
    font-size: 10px;
    letter-spacing: 0.5px;
    margin-bottom: 0;
    height: 16px;
    line-height: 16px;
}

/* Inputs */
#vector-comparator #settings-section input[type="text"],
#vector-comparator #settings-section input[type="number"] {
    border: 1px solid #e8edeb;
    border-radius: 6px;
    font-weight: 500;
    font-size: 13px;
    padding: 0.5rem 0.75rem;
    background: #fff;
    color: #001e2b;
    width: 100%;
    box-sizing: border-box;
    height: 36px;
}

.comparator-widget.dark-theme #settings-section input[type="text"],
.comparator-widget.dark-theme #settings-section input[type="number"] {
    background-color: #112733;
    border: 1px solid #124151;
    color: #f9fafb;
}

#vector-comparator #settings-section input[type="text"]::placeholder,
#vector-comparator #settings-section input[type="number"]::placeholder {
    color: #9ca3af;
}

/* Disabled inputs */
#vector-comparator #settings-section input[type="text"][disabled],
#vector-comparator #settings-section input[type="text"][readOnly],
#vector-comparator #settings-section input[type="number"][disabled],
#vector-comparator #settings-section input[type="number"][readOnly] {
    background-color: #e8edeb;
    color: #889397;
    cursor: default;
    border-color: #c1c7c6;
}

.comparator-widget.dark-theme #settings-section input[type="text"][disabled],
.comparator-widget.dark-theme #settings-section input[type="text"][readOnly],
.comparator-widget.dark-theme #settings-section input[type="number"][disabled],
.comparator-widget.dark-theme #settings-section input[type="number"][readOnly] {
    background-color: #0d212b;
    color: #9ca3af;
    border-color: #0b5d3a;
    opacity: 1;
    cursor: default;
}

/* Button group on the right */
.button-group {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
}

.action-button {
    background: #f9fbfa;
    border: 1px solid #889397;
    color: #001e2b;
    display: inline-block;
    font-size: 13px;
    font-weight: 500;
    height: 36px;
    line-height: 34px;
    padding: 0 12px;
    text-transform: capitalize;
    cursor: pointer;
    transition: all 120ms ease;
    text-decoration: none;
    outline: none;
    font-family: "Euclid Circular A", "Helvetica Neue", Helvetica, Arial, sans-serif;
    border-radius: 6px !important;
}

.comparator-widget .action-button {
    margin: 0;
    padding: 0 12px;
}

.comparator-widget .action-button:hover:not([disabled]),
.comparator-widget .action-button:active:not([disabled]) {
    color: #001e2b;
    background: #f9fbfa;
    box-shadow: 0 0 0 3px #e8edeb;
    outline: 0;
}

.comparator-widget.dark-theme .action-button {
    appearance: none;
    padding: 0 12px;
    margin: 0;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    transition: 150ms ease-in-out;
    position: relative;
    text-decoration: none;
    cursor: pointer;
    z-index: 0;
    border-radius: 6px;
    background-color: rgb(0, 104, 74);
    border: 1px solid rgb(0, 237, 100);
    color: rgb(255, 255, 255);
    font-size: 13px;
    font-weight: 500;
    height: 36px;
}

.comparator-widget.dark-theme .action-button:hover:not([disabled]),
.comparator-widget.dark-theme .action-button:active:not([disabled]) {
    background: #00593f;
    color: #ffffff;
    box-shadow: 0 0 0 1px rgba(0, 237, 100, 0.35);
}

.comparator-widget button[disabled] {
    cursor: not-allowed;
    opacity: 0.7;
}

/* Error banner */
.error-banner {
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    margin-top: 0.5rem;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #dc3545;
    background-color: #f8d7da;
    color: #721c24;
    font-weight: bold;
}

/* Results area: single scroll region for all models */
.results-grid {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem 0.25rem 0.25rem 0.25rem;
    height: 400px;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: auto;
    box-sizing: border-box;
}

.result-column {
    flex: 1 1 0;
    min-width: 250px;
    max-width: 400px;
    display: flex;
    flex-direction: column;
}

.section-title.model-header {
    font-weight: 700;
    text-transform: uppercase;
    color: #889397;
    font-size: 10px;
    letter-spacing: 0.5px;
    margin-top: 0;
    margin-bottom: 0.75rem;
}

/* Doc list, no own scroll */
.result-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-right: 0.25rem;
    padding-bottom: 0.5rem;
}

/* Card */
.doc-card.comparator-doc-card {
    background: #fff;
    padding: 1rem;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    font-family: "Euclid Circular A", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 12px;
}

.comparator-widget.dark-theme .doc-card.comparator-doc-card {
    background-color: #1c2d39;
    color: rgb(232, 237, 235);
    border-radius: 12px;
    border: 1px solid #3d4f58;
    background: #1c2d38;
}

.doc-card-header,
.doc-card-content {
    margin-bottom: 0.5rem;
}

.doc-card-header:last-child,
.doc-card-content:last-child {
    margin-bottom: 0;
}

.doc-key {
    font-weight: bold;
    color: #000;
}

.doc-value {
    color: #24292e;
}

.doc-value-score {
    color: #d9472b;
}

.doc-value-text {
    color: #5aa381;
}

/* Placeholder */
.placeholder-text {
    color: #889397;
    font-size: 13px;
    text-align: center;
    margin: auto;
}

/* Scrollbars */
.results-grid {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
    scrollbar-gutter: stable;
}

.results-grid::-webkit-scrollbar {
    width: 8px;
    height: 8px;
    background-color: transparent;
}

.results-grid::-webkit-scrollbar-thumb {
    background-color: transparent;
    border-radius: 4px;
}

.results-grid:hover::-webkit-scrollbar-thumb,
.results-grid:active::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
}

.comparator-widget.dark-theme .results-grid {
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.comparator-widget.dark-theme .results-grid:hover::-webkit-scrollbar-thumb,
.comparator-widget.dark-theme .results-grid:active::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Responsive */
@media (max-width: 900px) {
    #vector-comparator #settings-section.comparator-settings {
        grid-template-columns: 1fr;
    }

    .button-group {
        justify-content: stretch;
    }

    .button-group .action-button {
        width: 100%;
    }
}