/**
 * By-Election Scenario Explorer Styles
 */

.scenario-explorer {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Data Source Badge */
.data-source-badge {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 20px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
}

.data-source-badge .source-label {
    font-weight: 600;
    color: #0369a1;
}

.data-source-badge .source-detail {
    color: #6b7280;
    font-size: 0.8rem;
}

.input-hint {
    font-size: 0.8rem;
    color: #6b7280;
    margin: 0 0 12px 0;
}

/* Controls Section */
.scenario-controls {
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.scenario-controls h4 {
    margin: 0 0 4px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
}

.controls-description {
    margin: 0 0 16px 0;
    font-size: 0.9rem;
    color: #6b7280;
}

/* Control Groups */
.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.control-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #374151;
}

.control-value {
    font-weight: 700;
    font-size: 1rem;
    color: #1f2937;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 4px;
}

/* Turnout Slider */
#turnout-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #e5e7eb 0%, #e5e7eb 100%);
    border-radius: 4px;
    outline: none;
    margin: 12px 0 8px 0;
}

#turnout-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #3b82f6;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.1s;
}

#turnout-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

#turnout-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #3b82f6;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #9ca3af;
}

.slider-labels .typical-range {
    background: #fef3c7;
    padding: 2px 6px;
    border-radius: 3px;
    color: #92400e;
    font-weight: 500;
}

.turnout-hint {
    margin-top: 6px;
}

.hint-text {
    font-size: 0.8rem;
    color: #6b7280;
}

/* Tactical Voting Options */
.tactical-options {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d1d5db;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #3b82f6;
}

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

#tactical-status {
    font-weight: 600;
    font-size: 0.9rem;
    color: #374151;
}

.tactical-hint {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 8px;
    padding: 8px 12px;
    background: #f0f9ff;
    border-radius: 6px;
    border-left: 3px solid #3b82f6;
}

/* Custom Poll Section */
.collapse-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #374151;
    transition: background 0.2s;
}

.collapse-toggle:hover {
    background: #f3f4f6;
}

.toggle-icon {
    font-size: 0.8rem;
    color: #6b7280;
}

.custom-poll-inputs {
    margin-top: 12px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
}

.poll-input-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.poll-input-row label {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #374151;
}

.party-dot {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

.poll-input {
    width: 70px;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.9rem;
    text-align: right;
}

.poll-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.percent-sign {
    color: #6b7280;
    font-size: 0.9rem;
}

.custom-poll-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    justify-content: flex-end;
}

.btn-primary,
.btn-secondary {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #3b82f6;
    color: #fff;
    border: none;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: #fff;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover {
    background: #f3f4f6;
}

/* Results Section */
.scenario-results {
    padding-top: 4px;
}

/* Race Call Display */
.race-call-display {
    text-align: center;
    padding: 16px;
    margin-bottom: 20px;
    background: #f9fafb;
    border-radius: 8px;
}

.race-status {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.race-leader {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.race-description {
    font-size: 0.9rem;
    color: #6b7280;
}

/* Win Probabilities */
.win-probabilities {
    margin-bottom: 20px;
}

.win-probabilities h5,
.vote-projections h5 {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.prob-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.prob-label {
    width: 140px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #374151;
}

.prob-bar-container {
    flex: 1;
    height: 24px;
    background: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
}

.prob-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.prob-value {
    width: 45px;
    text-align: right;
    font-weight: 600;
    font-size: 0.9rem;
    color: #1f2937;
}

/* Vote Projections Table */
.vote-table {
    width: 100%;
    border-collapse: collapse;
}

.vote-table th,
.vote-table td {
    padding: 10px 12px;
    text-align: left;
}

.vote-table th {
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e5e7eb;
}

.vote-table td {
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.9rem;
}

.vote-table tr:last-child td {
    border-bottom: none;
}

.vote-table .share-value {
    font-weight: 600;
    color: #1f2937;
}

.vote-table .range-value {
    color: #6b7280;
    font-size: 0.85rem;
}

/* Methodology Note */
.methodology-note {
    margin-top: 20px;
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #6b7280;
    line-height: 1.5;
}

.methodology-note strong {
    color: #374151;
}

.learn-more {
    color: #3b82f6;
    text-decoration: none;
    margin-left: 4px;
}

.learn-more:hover {
    text-decoration: underline;
}

/* Demographic Controls */
.demographic-controls {
    margin-top: 12px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
}

.demographic-slider-group {
    margin-bottom: 16px;
}

.demographic-slider-group:last-child {
    margin-bottom: 8px;
}

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

.demo-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #374151;
}

.demo-value {
    font-weight: 700;
    font-size: 0.9rem;
    color: #1f2937;
    background: #e5e7eb;
    padding: 2px 8px;
    border-radius: 4px;
    min-width: 50px;
    text-align: center;
}

.demo-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #fca5a5 0%, #fca5a5 40%, #e5e7eb 40%, #e5e7eb 60%, #86efac 60%, #86efac 100%);
    border-radius: 4px;
    outline: none;
    margin: 8px 0;
}

.demo-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #3b82f6;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.1s;
}

.demo-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.demo-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #3b82f6;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.demo-slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #9ca3af;
}

.demo-effect-hint {
    font-size: 0.7rem;
    color: #6b7280;
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 3px;
}

.demographic-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .scenario-explorer {
        padding: 16px;
    }

    .data-source-badge {
        flex-wrap: wrap;
        gap: 4px;
    }

    .data-source-badge .description {
        width: 100%;
    }

    .tactical-options {
        flex-direction: column;
        gap: 8px;
    }

    .prob-row {
        flex-wrap: wrap;
    }

    .prob-label {
        width: 100%;
    }

    .prob-bar-container {
        width: calc(100% - 55px);
    }

    .vote-table th:nth-child(3),
    .vote-table td:nth-child(3) {
        display: none;
    }
}
