@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700;800&display=swap');

:root {
    --bg-color: #050510;
    --card-bg: rgba(255, 255, 255, 0.05);
    --primary-neon: #00f3ff;
    --secondary-neon: #bc13fe;
    --success-neon: #34d399;
    --danger-neon: #ff0055;
    --warning-neon: #facc15;
    --text-color: #e0e0e0;
    --text-dim: #94a3b8;
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(188, 19, 254, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(0, 243, 255, 0.1) 0%, transparent 20%);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s;
    margin-bottom: 2rem;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-5px);
    border-color: var(--primary-neon);
}

header {
    text-align: center;
    margin-bottom: 2rem;
    animation: fadeInDown 1s ease-out;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #fff, var(--primary-neon));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 20px rgba(0, 243, 255, 0.3);
}

.subtitle {
    font-size: 1.2rem;
    color: var(--secondary-neon);
    text-shadow: 0 0 10px rgba(188, 19, 254, 0.5);
    margin-bottom: 0.5rem;
}

/* Glassmorphism Cards */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 10px 40px rgba(0, 243, 255, 0.1);
    border-color: rgba(0, 243, 255, 0.3);
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #fff;
    border-bottom: 2px solid var(--primary-neon);
    display: inline-block;
    padding-bottom: 5px;
}

/* ===== MAIN TABS ===== */
.main-tabs {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.main-tab-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-color);
    padding: 1rem 2rem;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1.1rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.main-tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.main-tab-btn.active {
    background: var(--primary-neon);
    color: #000;
    border-color: var(--primary-neon);
    box-shadow: 0 0 15px var(--primary-neon);
}

/* ===== SLIDERS: SECTION 1 (Dual) ===== */
.slider-group {
    margin-bottom: 2rem;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.slider-label span:first-child {
    color: var(--primary-neon);
}

.slider-values {
    font-family: monospace;
    color: #fff;
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 8px;
    border-radius: 4px;
}

.dual-slider-container {
    position: relative;
    height: 40px;
    display: flex;
    align-items: center;
}

input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: transparent;
}

.dual-slider-container input[type=range] {
    position: absolute;
    pointer-events: none;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    pointer-events: auto;
    margin-top: -8px;
    box-shadow: 0 0 10px var(--primary-neon);
    border: 2px solid var(--primary-neon);
    position: relative;
    z-index: 10;
    transition: transform 0.1s;
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider-track {
    width: 100%;
    height: 4px;
    background: #333;
    border-radius: 2px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
}

.slider-range-highlight {
    position: absolute;
    height: 4px;
    background: var(--primary-neon);
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    box-shadow: 0 0 8px var(--primary-neon);
}

/* Specific colors */
.section-sensitivity .slider-range-highlight,
.section-sensitivity input[type=range]::-webkit-slider-thumb {
    background-color: var(--primary-neon);
    border-color: var(--primary-neon);
    box-shadow: 0 0 10px var(--primary-neon);
}

.section-specificity .slider-range-highlight,
.section-specificity input[type=range]::-webkit-slider-thumb {
    background-color: var(--secondary-neon);
    border-color: var(--secondary-neon);
    box-shadow: 0 0 10px var(--secondary-neon);
}

.section-prevalence .slider-range-highlight,
.section-prevalence input[type=range]::-webkit-slider-thumb {
    background-color: var(--danger-neon);
    border-color: var(--danger-neon);
    box-shadow: 0 0 10px var(--danger-neon);
}

/* ===== NUMBER INPUT & BUTTONS ===== */
.input-group {
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
}

.input-label {
    color: var(--primary-neon);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

input[type="number"] {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    outline: none;
    width: 100%;
    max-width: 200px;
    box-shadow: 0 0 5px rgba(0, 243, 255, 0.1);
    transition: all 0.3s ease;
}

input[type="number"]:focus {
    border-color: var(--primary-neon);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.2);
}

.btn-container {
    text-align: center;
    margin: 3rem 0;
}

.btn-neon {
    background: transparent;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    padding: 1rem 3rem;
    border: 2px solid var(--primary-neon);
    border-radius: 50px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
}

.btn-neon:hover {
    background: var(--primary-neon);
    color: #000;
    box-shadow: 0 0 20px var(--primary-neon), 0 0 40px var(--primary-neon);
}

.btn-pulse {
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 243, 255, 0.4);
    }

    70% {
        box-shadow: 0 0 0 20px rgba(0, 243, 255, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 243, 255, 0);
    }
}

/* RESULTS GRID VIEW 1 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.stat-box {
    text-align: center;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border-left: 4px solid var(--primary-neon);
}

.stat-box.negative {
    border-left-color: var(--danger-neon);
}

.stat-box h3 {
    font-size: 1rem;
    color: #ccc;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.charts-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .charts-container {
        grid-template-columns: 1fr;
    }
}

.chart-wrapper {
    min-height: 400px;
}

/* ===== TEST COMBINATIONS STYLES ===== */

.info-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

@media (max-width: 900px) {
    .info-section {
        grid-template-columns: 1fr;
    }
}

.info-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    min-width: 0;
    max-width: 100%;
}

.info-card h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
    border-bottom: 2px solid var(--secondary-neon);
}

.info-card p,
.styled-list li {
    color: var(--text-dim);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.styled-list {
    list-style-type: none;
    padding-left: 1rem;
}

.styled-list li {
    position: relative;
}

.styled-list li::before {
    content: "•";
    color: var(--secondary-neon);
    font-size: 1.5rem;
    position: absolute;
    left: -1rem;
    top: -4px;
}

.error-types {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.error-box {
    flex: 1;
    min-width: 0;
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 12px;
    border-left: 4px solid var(--warning-neon);
}

.error-box.type-i {
    border-left-color: var(--danger-neon);
}

.error-box.type-ii {
    border-left-color: var(--primary-neon);
}

/* Combo Simulation Area */
.simulation-area {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

@media (max-width: 900px) {
    .simulation-area {
        grid-template-columns: 1fr;
    }
}

.test-config {
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    border-radius: 12px;
}

.test-config h3 {
    margin-bottom: 1rem;
    color: #fff;
    font-weight: 600;
}

.styled-test-a {
    border-left: 3px solid var(--primary-neon);
}

.styled-test-b {
    border-left: 3px solid var(--secondary-neon);
}

.slider-group.single input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    margin-top: 5px;
}

.slider-group.single input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 18px;
    width: 18px;
    border-radius: 50%;
    margin-top: -6px;
}

.styled-test-a input[type=range]::-webkit-slider-thumb {
    background: var(--primary-neon);
    box-shadow: 0 0 10px var(--primary-neon);
}

.styled-test-b input[type=range]::-webkit-slider-thumb {
    background: var(--secondary-neon);
    box-shadow: 0 0 10px var(--secondary-neon);
}

.combo-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.combo-tab-btn {
    background: transparent;
    border: 1px solid var(--primary-neon);
    color: var(--text-color);
    padding: 0.8rem 1.5rem;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.combo-tab-btn:hover {
    background: rgba(0, 243, 255, 0.1);
}

.combo-tab-btn.active {
    background: var(--primary-neon);
    color: #000;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
}

/* Metrics Grid View 2 */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
}

@media (max-width: 1024px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.metric-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 2.5rem 1.5rem;
    /* Increased vertical padding to make them taller */
    border-radius: 12px;
    text-align: center;
    border: 1px solid transparent;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.metric-box:hover {
    transform: translateY(-5px);
}

.metric-box.box-sen {
    border-bottom: 3px solid var(--success-neon);
}

.metric-box.box-sp {
    border-bottom: 3px solid var(--primary-neon);
}

.metric-box.box-ppv {
    border-bottom: 3px solid var(--warning-neon);
}

.metric-box.box-npv {
    border-bottom: 3px solid var(--secondary-neon);
}

.metric-box h4 {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 800;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

.box-sen .metric-value {
    color: var(--success-neon);
}

.box-sp .metric-value {
    color: var(--primary-neon);
}

.box-ppv .metric-value {
    color: var(--warning-neon);
}

.box-npv .metric-value {
    color: var(--secondary-neon);
}

.viz-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-width: 0;
    width: 100%;
}


/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    margin-top: auto;
    font-size: 0.9rem;
    color: #666;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== CUSTOM TABLE LAYOUT ===== */
.calculator-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4rem;
    max-width: 100%;
    margin: 0 auto;
    flex-wrap: wrap;
    /* Allows stacking on mobile */
}

.two-by-two-grid {
    display: grid;
    grid-template-columns: auto 250px 250px;
    /* Explicit large width */
    gap: 2rem;
    align-items: center;
}

.two-by-two-grid .input-cell {
    transition: transform 0.2s;
    padding: 2.5rem !important;
    /* Spacious padding */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.two-by-two-grid input[type="number"] {
    width: 100%;
    max-width: none;
    text-align: center;
    font-size: 2rem !important;
    /* Huge input numbers */
    margin-top: 1rem;
}

.two-by-two-grid .input-cell:focus-within {
    transform: scale(1.05);
}

.calc-metrics {
    display: grid;
    grid-template-columns: repeat(2, 250px) !important;
    /* Explicit spacious result boxes */
    gap: 2rem;
    margin-bottom: 0;
}

.calc-metrics .metric-box {
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

@media (max-width: 1100px) {
    .calculator-layout {
        gap: 2rem;
    }

    .two-by-two-grid {
        grid-template-columns: auto 200px 200px;
        /* Slightly shrink cells on mid-screens */
        gap: 1.5rem;
    }

    .calc-metrics {
        grid-template-columns: repeat(2, 200px) !important;
        gap: 1.5rem;
    }
}

@media (max-width: 900px) {
    .calculator-layout {
        flex-direction: column;
        gap: 3rem;
    }

    .two-by-two-grid {
        grid-template-columns: auto 1fr 1fr;
        width: 100%;
        max-width: 600px;
        gap: 1rem;
    }

    .calc-metrics {
        grid-template-columns: repeat(2, 1fr) !important;
        width: 100%;
        max-width: 600px;
    }

    /* Make the row labels stack better or adjust sizes for mobile */
    .two-by-two-grid>div:nth-child(3n+1) {
        text-align: right !important;
        font-size: 0.95rem;
        padding-right: 0.5rem;
    }

    .two-by-two-grid input[type="number"] {
        font-size: 1.5rem !important;
        margin-top: 0.5rem;
    }

    .two-by-two-grid .input-cell {
        padding: 1.5rem !important;
    }
}

/* ===== ROC CURVE LAYOUT ===== */
.roc-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    max-width: 800px;
    margin: 0 auto 2rem auto;
    gap: 1.5rem;
}

.roc-charts {
    display: grid;
    grid-template-columns: 1fr;
    /* Stacked layout */
    gap: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }
    h1 {
        font-size: 1.8rem !important;
    }
    .main-tabs {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 1rem;
    }
    .main-tab-btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.95rem;
        white-space: nowrap;
    }
    
    body,
    html {
        max-width: 100vw;
        overflow-x: hidden;
    }

    .container {
        padding: 0.75rem;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }

    .card {
        padding: 1rem;
        margin-bottom: 1rem;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    h1 {
        font-size: 1.5rem;
        word-wrap: break-word;
    }

    .subtitle {
        font-size: 1rem;
        word-wrap: break-word;
    }

    p,
    li,
    h2,
    h3,
    h4 {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .roc-metrics {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .main-tab-btn,
    .combo-tab-btn {
        padding: 0.6rem 0.4rem;
        font-size: 0.85rem;
        flex: 1 1 48%;
        text-align: center;
        white-space: normal;
        min-height: 50px;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .two-by-two-grid {
        grid-template-columns: auto 1fr 1fr;
        gap: 0.5rem;
    }

    .two-by-two-grid .input-cell {
        padding: 0.5rem !important;
        min-width: 0;
    }

    .two-by-two-grid input[type="number"] {
        font-size: 1.1rem !important;
        padding: 5px;
        width: 100%;
    }

    .two-by-two-grid>div:nth-child(3n+1) {
        font-size: 0.75rem;
    }

    .metric-box {
        padding: 1rem;
        min-width: 0;
    }

    h2 {
        font-size: 1.2rem;
        text-align: center;
    }

    .info-card {
        padding: 1rem;
        min-width: 0;
        max-width: 100%;
    }

    .test-config {
        padding: 1rem;
        min-width: 0;
    }

    .error-types {
        flex-direction: column;
        gap: 1rem;
    }

    .error-box {
        width: 100%;
        min-width: 0;
        margin: 0;
    }

    .viz-container {
        padding: 0.5rem;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        min-width: 0;
    }

    .slider-group.single {
        width: 100%;
        max-width: 100% !important;
        box-sizing: border-box;
    }

    .slider-label {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }

    .slider-label span {
        font-size: 0.85rem !important;
        white-space: normal;
    }

    .chart-wrapper,
    #heatmap-chart,
    #roc-distribution-chart,
    #roc-curve-chart,
    .js-plotly-plot {
        width: 100% !important;
        max-width: 100% !important;
    }
}