:root {
    --bg-page: #0b0f14;
    --bg-page-soft: #0f141c;
    --bg-card: rgba(18, 25, 35, 0.94);
    --bg-card-soft: rgba(255, 255, 255, 0.025);
    --bg-header: #141c28;
    --bg-input: #0f1622;
    --bg-input-hover: #111b29;
    --bg-plot: #0d141e;

    --text-main: #e8edf5;
    --text-muted: #a8b3c7;
    --text-soft: #8b96aa;
    --text-heading: #f4f7fb;

    --border-soft: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);

    --primary: #DE402E;
    --primary-soft: rgba(222, 64, 46, 0.16);
    --primary-glow: rgba(222, 64, 46, 0.28);

    --shadow-card: 0 18px 45px rgba(0, 0, 0, 0.42);
    --shadow-field: 0 6px 16px rgba(0, 0, 0, 0.25);
    --shadow-field-hover: 0 10px 24px rgba(0, 0, 0, 0.32);

    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 10px;

    --transition: 0.25s ease;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(222, 64, 46, 0.10), transparent 30%),
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.035), transparent 26%),
        linear-gradient(180deg, var(--bg-page) 0%, var(--bg-page-soft) 100%);
    color: var(--text-main);
}

/* Navbar */

.navbar {
    background: var(--primary);
    color: #ffffff;
    padding: 18px 40px;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 1px;
    box-shadow:
        0 10px 28px rgba(0, 0, 0, 0.35),
        0 0 24px rgba(222, 64, 46, 0.24);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

/* Main container */

.container {
    max-width: 1500px;
    margin: 50px auto;
    padding: 0 20px 42px;
}

/* Main card */

.card {
    background: var(--bg-card);
    color: var(--text-main);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    border: 1px solid var(--border-soft);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.card-header {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)),
        var(--bg-header);
    color: var(--text-heading);
    padding: 24px 30px;
    border-bottom: 1px solid var(--border-soft);
}

.card-header h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-heading);
}

.card-header p {
    margin: 8px 0 0;
    color: var(--text-muted);
}

.card-body {
    padding: 32px 30px;
}

/* Typography */

h2 {
    color: var(--text-heading);
    font-size: 22px;
    margin: 8px 0 18px;
    font-weight: 700;
}

hr {
    border: 0;
    border-top: 1px solid var(--border-soft);
    margin: 30px 0;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #d9e2f1;
}

small {
    display: inline-block;
    margin-top: 8px;
    color: var(--text-soft);
    line-height: 1.45;
}

/* Form layout */

.form-group {
    margin-bottom: 24px;
}

.form-row {
    display: grid;
    gap: 24px;
    margin-bottom: 24px;
}

.form-row-2 {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
}

.form-row-3 {
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    column-gap: 36px;
    row-gap: 28px;
}

.form-row .form-group {
    margin-bottom: 0;
    padding: 0 12px;
    min-width: 0;
}

/* Fields */

select,
input,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 15px;
    background: var(--bg-input);
    color: var(--text-main);
    box-shadow:
        var(--shadow-field),
        0 1px 0 rgba(255, 255, 255, 0.035) inset;
    transition:
        border-color var(--transition),
        box-shadow var(--transition),
        background var(--transition),
        transform var(--transition);
}

select:hover,
input:hover,
textarea:hover {
    background: var(--bg-input-hover);
    box-shadow:
        var(--shadow-field-hover),
        0 1px 0 rgba(255, 255, 255, 0.045) inset;
}

select:focus,
input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-input-hover);
    box-shadow:
        0 0 0 4px var(--primary-soft),
        0 10px 24px rgba(0, 0, 0, 0.34),
        0 0 20px rgba(222, 64, 46, 0.13);
    transform: translateY(-1px);
}

select option {
    background: #111822;
    color: var(--text-main);
}

select::placeholder,
input::placeholder,
textarea::placeholder {
    color: #7f8aa0;
}

/* Hidden inputs should not create visible boxes */

input[type="hidden"] {
    display: none;
}

/* Info and error boxes */

.info-box {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015));
    border-left: 5px solid var(--primary);
    padding: 16px 20px;
    margin-bottom: 26px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    border-top: 1px solid var(--border-soft);
    border-right: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.info-box ul {
    margin: 0;
    padding-left: 20px;
}

.info-box li {
    color: var(--primary);
    margin-bottom: 6px;
}

.errorlist {
    color: #ffd8d3;
    background: rgba(222, 64, 46, 0.14);
    border-left: 4px solid var(--primary);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    list-style: none;
    margin-bottom: 15px;
}

/* Buttons */

.btn {
    background: var(--primary);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 13px 26px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    cursor: pointer;
    font-weight: 700;
    text-decoration: none;
    box-shadow:
        0 10px 22px rgba(222, 64, 46, 0.28),
        0 1px 0 rgba(255, 255, 255, 0.18) inset;
    transition:
        transform var(--transition),
        box-shadow var(--transition),
        filter var(--transition);
}

.btn:hover {
    color: #ffffff;
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow:
        0 14px 28px rgba(222, 64, 46, 0.36),
        0 0 20px rgba(222, 64, 46, 0.18);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 8px 18px rgba(222, 64, 46, 0.28);
}

.btn:disabled {
    opacity: 0.72;
    cursor: not-allowed;
    transform: none;
}

/* Slider wrapper */

.slider-wrapper {
    padding: 16px;
    border-radius: var(--radius-md);
    background: var(--bg-card-soft);
    border: 1px solid var(--border-soft);
    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.24),
        0 1px 0 rgba(255, 255, 255, 0.035) inset;
    transition:
        box-shadow var(--transition),
        transform var(--transition),
        border-color var(--transition),
        background var(--transition);
}

.slider-wrapper:hover {
    background: rgba(255, 255, 255, 0.035);
    border-color: rgba(222, 64, 46, 0.22);
    box-shadow:
        0 12px 28px rgba(0, 0, 0, 0.32),
        0 0 0 1px rgba(222, 64, 46, 0.08),
        0 0 18px rgba(222, 64, 46, 0.08);
    transform: translateY(-1px);
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.slider-header strong {
    white-space: nowrap;
    flex-shrink: 0;
    color: var(--text-main);
}

.slider-header output,
.slider-header span {
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

input[type="range"] {
    width: 100%;
    padding: 0;
}

output {
    display: block;
    margin-top: 8px;
    font-weight: 700;
    color: var(--primary);
}

/* noUiSlider */

.noUi-target {
    background: #0d141f;
    border: 1px solid var(--border-soft);
    box-shadow:
        0 5px 14px rgba(0, 0, 0, 0.24) inset,
        0 3px 8px rgba(0, 0, 0, 0.22);
    border-radius: 999px;
    height: 10px;
}

.noUi-connect {
    background: var(--primary);
    box-shadow: 0 0 14px rgba(222, 64, 46, 0.28);
}

.noUi-handle {
    border: 2px solid var(--primary);
    background: #ffffff;
    box-shadow:
        0 5px 16px rgba(0, 0, 0, 0.45),
        0 0 14px rgba(222, 64, 46, 0.22);
    border-radius: 50%;
    cursor: pointer;
}

.noUi-horizontal .noUi-handle {
    width: 20px;
    height: 20px;
    right: -10px;
    top: -6px;
}

.noUi-handle:before,
.noUi-handle:after {
    display: none;
}

/* Loader */

#loader-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(8, 12, 18, 0.84);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.14);
    border-top: 6px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow:
        0 0 20px rgba(222, 64, 46, 0.24),
        0 8px 24px rgba(0, 0, 0, 0.32);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loader-text {
    margin-top: 18px;
    font-weight: 700;
    color: var(--text-heading);
    letter-spacing: 0.2px;
}

/* Results and carousel */

.results-section {
    margin-top: 42px;
}

.carousel-container {
    background: rgba(16, 22, 31, 0.94);
    border-radius: var(--radius-lg);
    box-shadow:
        0 18px 42px rgba(0, 0, 0, 0.38),
        0 1px 0 rgba(255, 255, 255, 0.035) inset;
    padding: 28px;
    border: 1px solid var(--border-soft);
}

.plot-card {
    max-width: 1100px;
    margin: 0 auto;
}

.plot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: 12px;
}

.plot-title {
    font-weight: 700;
    color: var(--text-main);
}

.plot-counter {
    background: var(--primary);
    color: #ffffff;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 14px;
    box-shadow: 0 6px 16px rgba(222, 64, 46, 0.28);
}

.plot-image-wrapper {
    background: var(--bg-plot);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 18px;
    text-align: center;
    box-shadow:
        0 12px 28px rgba(0, 0, 0, 0.28) inset,
        0 8px 20px rgba(0, 0, 0, 0.24);
}

.plot-image {
    max-width: 100%;
    max-height: 700px;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.plot-actions {
    margin-top: 18px;
    text-align: center;
}

/* Carousel controls */

.custom-carousel-control {
    width: 48px;
    height: 48px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    color: #ffffff;
    border-radius: 50%;
    opacity: 0.96;
    font-size: 42px;
    line-height: 38px;
    box-shadow:
        0 10px 24px rgba(0, 0, 0, 0.38),
        0 0 18px rgba(222, 64, 46, 0.22);
    transition:
        opacity var(--transition),
        filter var(--transition),
        box-shadow var(--transition);
}

.custom-carousel-control:hover {
    opacity: 1;
    filter: brightness(1.08);
    box-shadow:
        0 14px 30px rgba(0, 0, 0, 0.45),
        0 0 24px rgba(222, 64, 46, 0.32);
}

.carousel-control-prev {
    left: -20px;
}

.carousel-control-next {
    right: -20px;
}

.custom-indicators {
    position: static;
    margin-top: 22px;
    margin-bottom: 0;
}

.custom-indicators [data-bs-target] {
    background-color: var(--primary);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    opacity: 0.45;
    border: none;
    transition:
        opacity var(--transition),
        transform var(--transition),
        box-shadow var(--transition);
}

.custom-indicators .active,
.custom-indicators [data-bs-target]:hover {
    opacity: 1;
    transform: scale(1.12);
    box-shadow: 0 0 14px rgba(222, 64, 46, 0.32);
}

#custom-pager {
    display: none;
}

/* HiPlot iframe */

iframe {
    background: var(--bg-plot) !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: var(--radius-md) !important;
    box-shadow:
        0 12px 28px rgba(0, 0, 0, 0.30),
        0 0 0 1px rgba(255, 255, 255, 0.02);
}

/* Links */

a {
    color: var(--primary);
}

a:hover {
    color: var(--primary);
    filter: brightness(1.08);
}

/* Footer */

.footer {
    text-align: center;
    margin-top: 35px;
    color: var(--text-soft);
    font-size: 14px;
}

/* Scrollbar */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #0f141c;
}

::-webkit-scrollbar-thumb {
    background: #3a4658;
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: #556176;
}

/* Responsive */

@media (max-width: 900px) {
    .form-row-3 {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
        column-gap: 28px;
        row-gap: 24px;
    }
}

@media (max-width: 650px) {
    .container {
        margin: 30px auto;
        padding: 0 14px 32px;
    }

    .navbar {
        padding: 16px 20px;
        font-size: 20px;
    }

    .card-header {
        padding: 20px 18px;
    }

    .card-header h1 {
        font-size: 24px;
    }

    .card-body {
        padding: 22px 18px;
    }

    .form-row-2,
    .form-row-3 {
        grid-template-columns: 1fr;
        row-gap: 20px;
    }

    .form-row .form-group {
        padding: 0;
    }

    .slider-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .carousel-container {
        padding: 18px;
    }

    .carousel-control-prev {
        left: -8px;
    }

    .carousel-control-next {
        right: -8px;
    }

    .custom-carousel-control {
        width: 42px;
        height: 42px;
        font-size: 36px;
        line-height: 32px;
    }
}


.action-area {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 8px;
    margin-bottom: 34px;
}

.section-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 34px 0 34px;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.section-divider::before,
.section-divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(222, 64, 46, 0.45),
        rgba(255, 255, 255, 0.10)
    );
}

.section-divider::after {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.10),
        rgba(222, 64, 46, 0.45),
        transparent
    );
}

.section-divider span {
    color: var(--primary);
    background: rgba(222, 64, 46, 0.09);
    border: 1px solid rgba(222, 64, 46, 0.22);
    border-radius: 999px;
    padding: 6px 14px;
    box-shadow:
        0 6px 16px rgba(0, 0, 0, 0.22),
        0 0 18px rgba(222, 64, 46, 0.10);
}

.output-dir-group {
    display: none;
}

/* Model usage checkbox */

.model-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.model-checkbox input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid var(--border-strong);
    background: var(--bg-input);
    cursor: pointer;
    position: relative;
    transition:
        background var(--transition),
        border-color var(--transition),
        box-shadow var(--transition),
        transform var(--transition);
}

.model-checkbox input[type="checkbox"]:hover {
    border-color: var(--primary);
    box-shadow:
        0 0 0 4px var(--primary-soft),
        0 4px 12px rgba(0, 0, 0, 0.3);
}

.model-checkbox input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow:
        0 0 12px rgba(222, 64, 46, 0.35);
}

.model-checkbox input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 12px;
    border: solid #ffffff;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

.model-checkbox span {
    transition: color var(--transition);
}

.model-checkbox:hover span {
    color: var(--text-heading);
}


.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.slider-header strong {
    flex: 1;
}


/* Checkbox inside slider card */

.model-checkbox {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
}

.model-checkbox input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    margin: 0;
    border-radius: 5px;
    border: 2px solid var(--border-strong);
    background: var(--bg-input);
    cursor: pointer;
    position: relative;
    transition: all var(--transition);
}

.model-checkbox input[type="checkbox"]:hover {
    border-color: var(--primary);
}

.model-checkbox input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(222,64,46,0.35);
}

.model-checkbox input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}


.slider-values {
    text-align: right;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px;
}

/* Slider help text + model checkbox */

.slider-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-top: 12px;
}

.slider-footer small {
    margin-top: 0;
    flex: 1;
}


/* Checkbox */

.model-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    white-space: nowrap;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.model-checkbox input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;

    width: 18px;
    height: 18px;
    margin: 0;

    border-radius: 5px;
    border: 2px solid var(--border-strong);
    background: var(--bg-input);

    cursor: pointer;
    position: relative;

    transition:
        background var(--transition),
        border-color var(--transition),
        box-shadow var(--transition);
}

.model-checkbox input[type="checkbox"]:hover {
    border-color: var(--primary);
}

.model-checkbox input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(222,64,46,0.35);
}

.model-checkbox input[type="checkbox"]:checked::after {
    content: "";

    position: absolute;
    left: 5px;
    top: 1px;

    width: 5px;
    height: 10px;

    border: solid white;
    border-width: 0 2px 2px 0;

    transform: rotate(45deg);
}

.model-checkbox span {
    color: var(--text-muted);
}

/* ==========================
   Tabs inside card header
   ========================== */


.tabs-header {
    padding: 0;
}



.custom-tabs {

    border-bottom: 1px solid var(--border-soft);

    padding-left: 25px;

    gap: 8px;

}



.custom-tabs .nav-link {

    color: var(--text-muted);

    background: transparent;

    border: none;

    padding: 18px 30px;

    font-size: 16px;

    font-weight: 700;

    border-radius: 12px 12px 0 0;

    transition: all var(--transition);

}



.custom-tabs .nav-link:hover {

    color: var(--text-heading);

    background: rgba(222,64,46,0.10);

}



.custom-tabs .nav-link.active {

    color: white;

    background: var(--primary);

    box-shadow:

        0 -5px 20px rgba(222,64,46,0.35);

}



.tab-content {

    width: 100%;

}



.tab-pane {

    padding-top: 5px;

}



@media(max-width:650px){

    .custom-tabs {

        flex-direction: column;

        padding: 10px;

    }


    .custom-tabs .nav-link {

        width:100%;

        text-align:center;

    }

}

/* ==========================
   Cluster Report
   ========================== */

.report-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    margin-top: 30px;
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 20px 28px;

    background:
        linear-gradient(
            180deg,
            rgba(255,255,255,0.035),
            rgba(255,255,255,0.01)
        ),
        var(--bg-header);

    border-bottom: 1px solid var(--border-soft);
}


.report-header h2 {
    margin: 0;
    color: var(--text-heading);
    font-size: 22px;
}


.report-badge {
    background: var(--primary);
    color: white;

    padding: 6px 14px;

    border-radius: 999px;

    font-size: 13px;
    font-weight: 700;

    box-shadow:
        0 6px 16px rgba(222,64,46,0.28);
}


.report-body {
    padding: 25px 28px;
}


.cluster-report {

    margin: 0;

    padding: 22px;

    background:
        linear-gradient(
            180deg,
            rgba(255,255,255,0.025),
            rgba(255,255,255,0.01)
        ),
        var(--bg-plot);

    border: 1px solid var(--border-soft);

    border-radius: var(--radius-md);

    color: var(--text-main);

    font-family:
        "JetBrains Mono",
        "Fira Code",
        Consolas,
        monospace;

    font-size: 14px;

    line-height: 1.7;

    white-space: pre-wrap;

    overflow-x: auto;

    box-shadow:
        0 12px 28px rgba(0,0,0,0.28) inset,
        0 8px 20px rgba(0,0,0,0.22);
}


.cluster-report::selection {
    background: var(--primary);
    color: white;
}


/* Highlight warning text */
.cluster-report {
    scrollbar-width: thin;
    scrollbar-color: #3a4658 #0f141c;
}


.cluster-report::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.cluster-report::-webkit-scrollbar-thumb {
    background: #3a4658;
    border-radius: 999px;
}

.champion-rules-group textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 10px;
}