/* === BAUHAUS DESIGN SYSTEM === */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;700;900&display=swap');

:root {
    /* Colors */
    --bg-canvas: #F0F0F0;
    --bg-white: #FFFFFF;
    --fg-primary: #121212;
    --color-red: #D02020;
    --color-blue: #1040C0;
    --color-yellow: #F0C020;
    --color-muted: #E0E0E0;

    /* Borders & Shadows */
    --border-width-mobile: 2px;
    --border-width-desktop: 4px;
    --border-color: #121212;

    --shadow-sm: 4px 4px 0px 0px #121212;
    --shadow-md: 6px 6px 0px 0px #121212;
    --shadow-lg: 8px 8px 0px 0px #121212;

    /* Typography */
    --font-main: 'Outfit', sans-serif;

    /* Transitions */
    --transition-snappy: all 0.2s cubic-bezier(0.1, 0.7, 1.0, 0.1);
    /* Mechanical feel */
}

/* === RESET & BASE === */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-canvas);
    color: var(--fg-primary);
    line-height: 1.5;
    min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    color: var(--fg-primary);
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
    line-height: 0.9;
    letter-spacing: -0.04em;
}

@media (min-width: 768px) {
    h1 {
        font-size: 4rem;
    }
}

/* === UTILITIES === */
.border-b-thick {
    border-bottom: var(--border-width-desktop) solid var(--border-color);
}

/* === LAYOUT COMPONENTS === */
header {
    background: var(--color-blue);
    border-bottom: var(--border-width-desktop) solid var(--border-color);
    padding: 3rem 0;
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
}

/* Abstract decorations for header */
header::after {
    content: '';
    position: absolute;
    right: 5%;
    top: 20%;
    width: 100px;
    height: 100px;
    background: var(--color-yellow);
    border: var(--border-width-mobile) solid var(--fg-primary);
    transform: rotate(15deg);
    z-index: 0;
}

header::before {
    content: '';
    position: absolute;
    right: 12%;
    top: 40%;
    width: 80px;
    height: 80px;
    background: var(--color-red);
    border-radius: 50%;
    border: var(--border-width-mobile) solid var(--fg-primary);
    z-index: 0;
}

.header-content {
    position: relative;
    z-index: 1;
}

.header-content h1 {
    color: var(--bg-white);
    text-shadow: 4px 4px 0px var(--fg-primary);
}

.header-content p {
    color: var(--bg-white);
    font-weight: 500;
    font-size: 1.25rem;
    background: var(--fg-primary);
    display: inline-block;
    padding: 0.2rem 0.8rem;
    transform: rotate(-1deg);
}

/* === CARDS === */
.section-card {
    background: var(--bg-white);
    border: var(--border-width-desktop) solid var(--border-color);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    position: relative;
    transition: var(--transition-snappy);
}

.section-card:hover {
    transform: translateY(-4px);
    box-shadow: 12px 12px 0px 0px var(--fg-primary);
}

.section-header {
    border-bottom: var(--border-width-mobile) solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h2 {
    margin: 0;
    font-size: 1.75rem;
}

/* === BUTTONS === */
.btn {
    border-radius: 0 !important;
    /* NO ROUNDED CORNERS */
    font-family: var(--font-main);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 0.6rem 1.5rem;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.1s ease-out;
    position: relative;
    top: 0;
    left: 0;
}

.btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px 0px var(--fg-primary);
}

.btn:active {
    transform: translate(2px, 2px);
    box-shadow: none;
}

@keyframes button-jump {
    0% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-10px);
    }

    50% {
        transform: translateY(0);
    }

    70% {
        transform: translateY(-5px);
    }

    100% {
        transform: translateY(0);
    }
}

.btn-jump {
    animation: button-jump 0.6s ease-out;
}

.btn-primary,
.btn-accent {
    background-color: var(--color-blue);
    color: white;
    border-color: var(--border-color);
}

.btn-primary:hover,
.btn-accent:hover {
    background-color: #0d3298;
    color: white;
}

.btn-success {
    background-color: var(--color-yellow);
    color: var(--fg-primary);
}

.btn-danger,
.btn-danger-glass {
    background-color: var(--color-red);
    color: white;
}

.btn-glass {
    background-color: var(--bg-white);
    color: var(--fg-primary);
}

.btn-disabled-interactive {
    opacity: 0.65;
    cursor: not-allowed !important;
    text-decoration: none;
    /* Keeps pointer events active for tooltips */
    pointer-events: auto !important;
}

/* === BAUHAUS BTN GROUP === */
.bauhaus-btn-group {
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    vertical-align: middle;
}

.bauhaus-btn-group .btn {
    margin-left: -2px !important;
    box-shadow: none !important;
    transform: none !important;
    border-radius: 0 !important;
    position: relative;
    /* Ensure borders overlap */
}

.bauhaus-btn-group .btn:first-child {
    margin-left: 0 !important;
}

.bauhaus-btn-group .btn:hover {
    z-index: 2;
    background-color: var(--bg-canvas);
}

.bauhaus-btn-group .btn-danger:hover {
    background-color: #b01b1b;
    /* Darker red */
}

.bauhaus-btn-group .btn:active {
    background-color: #ddd;
}

/* === FORMS & INPUTS === */
.form-control,
.form-select {
    border: 2px solid var(--border-color) !important;
    border-radius: 0 !important;
    padding: 0.6rem;
    padding-right: 2.5rem !important;
    /* Make space for the arrow */
    box-shadow: 3px 3px 0 0 rgba(0, 0, 0, 0.1);
    font-weight: 500;
    background-color: var(--bg-white) !important;
    color: var(--fg-primary) !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.form-control:focus,
.form-select:focus {
    box-shadow: var(--shadow-sm) !important;
    border-color: var(--border-color) !important;
    background-color: #fff !important;
}

/* Custom Checkbox/Switch */
.switch {
    width: 60px;
    height: 32px;
    border: 3px solid var(--border-color);
    background: var(--bg-white);
    position: relative;
    display: inline-block;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 3px;
    left: 3px;
    bottom: 3px;
    right: 3px;
    background-color: var(--bg-white);
    transition: .2s;
}

.slider:before {
    position: absolute;
    content: "";
    /* Square toggle */
    height: 20px;
    width: 20px;
    left: 0;
    bottom: 0;
    background-color: var(--fg-primary);
    transition: .2s cubic-bezier(0.1, 0.7, 1.0, 0.1);
}

input:checked+.slider:before {
    transform: translateX(28px);
    background-color: var(--color-blue);
}

/* === PARTY CARDS === */
.party-card {
    background: var(--bg-white);
    border: 3px solid var(--border-color);
    padding: 1.5rem;
    height: 100%;
    position: relative;
    transition: var(--transition-snappy);
    box-shadow: var(--shadow-sm);
}

.party-card:hover {
    transform: translate(-3px, -3px);
    box-shadow: var(--shadow-lg);
    z-index: 10;
}

.party-card::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border: 3px solid var(--party-color, var(--fg-primary));
    pointer-events: none;
    z-index: -1;
}

.party-color-indicator {
    width: 20px;
    height: 20px;
    border: 2px solid var(--fg-primary);
    border-radius: 0 !important;
    /* Square */
    display: inline-block;
    vertical-align: middle;
}

.party-card .form-control {
    text-overflow: clip;
    padding-right: 0.6rem !important;
}

/* === RANGES === */
.party-card .form-range {
    margin-bottom: 1.5rem !important;
    /* Increased space as requested */
}

.form-range {
    height: 8px;
    background: var(--border-color);
    border-radius: 0;
    border: 1px solid var(--border-color);
    /* Standard appearance override if needed for some browsers */
    -webkit-appearance: none;
    appearance: none;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--color-blue);
    border: 2px solid var(--fg-primary);
    border-radius: 0;
    /* Square thumb */
    cursor: pointer;
    box-shadow: 2px 2px 0 var(--fg-primary);
    margin-top: -8px;
    /* Alignment fix */
}

.form-range::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: var(--color-muted);
    border: 1px solid var(--fg-primary);
}

/* === FORM OVERRIDES === */
.form-check-input {
    background-color: var(--bg-white);
    border: 2px solid var(--border-color) !important;
    border-radius: 0 !important;
    /* Square */
    width: 1.25em;
    height: 1.25em;
    margin-top: 0.15em;
    cursor: pointer;
    transition: all 0.1s ease;
    position: relative;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.1);
}

.form-check-input:checked {
    background-color: var(--color-blue);
    border-color: var(--border-color) !important;
    box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.1);
    transform: translate(1px, 1px);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='square' stroke-linejoin='miter' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e");
}

.form-check-input:focus {
    box-shadow: 0 0 0 2px rgba(18, 18, 18, 0.1);
    border-color: var(--border-color);
}

.form-check-label {
    color: var(--fg-primary);
    padding-left: 0.2rem;
    cursor: pointer;
}

.input-group-text {
    background-color: var(--bg-white) !important;
    border: 2px solid var(--border-color) !important;
    color: var(--fg-primary) !important;
    font-weight: 700;
    border-radius: 0 !important;
}

/* === SCROLLBARS === */
::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

::-webkit-scrollbar-track {
    background: var(--bg-canvas);
    border-left: 2px solid var(--border-color);
    border-top: 2px solid var(--border-color);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-white);
    border: 2px solid var(--border-color);
    box-shadow: inset -1px -1px 0 rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-blue);
}

::-webkit-scrollbar-corner {
    background: var(--border-color);
}

/* === TABLES === */
.table {
    border: 2px solid var(--border-color);
    color: var(--fg-primary);
}

.table thead th {
    background-color: var(--fg-primary) !important;
    color: var(--bg-white) !important;
    text-transform: uppercase;
    font-family: var(--font-main);
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-color);
    padding: 1rem;
}

.table tbody td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
}

.table-hover tbody tr:hover {
    background-color: rgba(16, 64, 192, 0.05) !important;
}

#survey-table tbody tr {
    cursor: pointer;
}

/* === PARLIAMENT & STATS === */
.parliament-container {
    background: radial-gradient(#ccc 1px, transparent 1px);
    background-size: 20px 20px;
    border: 2px solid var(--border-color);
    padding: 2rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-white);
    border: 3px solid var(--border-color);
    padding: 1.5rem;
    text-align: center;
    box-shadow: 6px 6px 0 var(--color-yellow);
    min-width: 200px;
}

.stat-value-big {
    font-size: 3rem;
    font-weight: 900;
    color: var(--color-blue);
    line-height: 1;
}

/* === FOOTER === */
footer {
    border-top: 4px solid var(--border-color);
    padding: 3rem 0;
    text-align: center;
    background: var(--fg-primary);
    color: var(--bg-white);
    margin-top: 4rem;
}

footer a {
    color: var(--color-yellow) !important;
}

/* === CSV LOADER === */
.csv-status {
    background: var(--bg-white);
    border: 2px solid var(--border-color);
    padding: 1rem;
    font-weight: bold;
}

.csv-status.loaded {
    background: #dcfce7;
    color: #14532d;
    border-color: #14532d;
    box-shadow: 4px 4px 0 #14532d;
}

/* === RESPONSIVE OVERRIDES === */
@media (max-width: 768px) {
    .section-card {
        padding: 1.5rem;
    }

    h1 {
        font-size: 2rem;
    }

    .party-card {
        margin-bottom: 1rem;
    }
}

/* === DYNAMIC UTILS === */
.value-highlight {
    font-weight: 900;
    color: var(--color-blue);
    background: rgba(16, 64, 192, 0.1);
    padding: 0.1rem 0.4rem;
    border: 1px solid var(--fg-primary);
}

.selected-row {
    background-color: var(--color-yellow) !important;
    border-left: 8px solid var(--fg-primary) !important;
    font-weight: 700;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 4px solid var(--fg-primary);
    border-top-color: var(--color-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

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

.text-muted {
    color: #666 !important;
}

/* === LAYOUT UTILS === */
@media (min-width: 992px) {
    .sticky-results {
        position: sticky;
        top: 2rem;
        z-index: 100;
        /* Removed max-height and overflow-y to let it grow as requested */
    }
}

/* === ULTRAWIDE MONITOR FIX === */
@media (min-aspect-ratio: 1.8/1) {
    main.container-fluid {
        padding-left: 15vw !important;
        padding-right: 15vw !important;
    }
}

/* === CUSTOM BREAKPOINT FOR SETTINGS === */
/* User requested: 1 card per row between 992px and 1600px */
@media (min-width: 992px) and (max-width: 1600px) {
    #party-inputs>div[class*="col-"] {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

/* === SMALL SWITCH === */
.switch.switch-sm {
    width: 40px;
    height: 24px;
    border-width: 2px;
}

.switch.switch-sm .slider {
    top: 2px;
    left: 2px;
    bottom: 2px;
    right: 2px;
}

.switch.switch-sm .slider:before {
    height: 16px;
    width: 16px;
}

.switch.switch-sm input:checked+.slider:before {
    transform: translateX(16px);
}

/* === CHANCE DISPLAY === */
.ind-chance-display {
    font-weight: 900;
    color: var(--color-blue);
}