section,
.section-single {
  margin-top: 3rem;  
  margin-bottom: 3rem;
}


.likert button.active {
  background:#0073aa;
  color:#fff;
}
.survey-group {
  margin-bottom:2rem;
}

.likert {
    display: flex;
    gap: 10px;
    margin: 10px 0 20px;
}

.likert button {
    padding: 10px 14px;
    border: 1px solid #ccc;
    background: #f7f7f7;
    cursor: pointer;
    border-radius: 4px;
    min-width: 50px;
}

.likert button.active {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

.likert button:hover {
    background: #e2e2e2;
}

.survey-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
}







/* Säiliö, joka pitää kaikki elementit rivissä */
.likert-container {
    display: flex;
    /* justify-content: space-between on avainasemassa, kun flex: 1 poistetaan */
    justify-content: space-between; 
    align-items: flex-start;
    position: relative;
    padding: 20px 0;
    width: 100%;
}

/* Yksittäinen sarake: Nappi + Teksti */
.likert-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Poistettu flex: 1, jotta itemit eivät täytä koko tilaa vaan asettuvat reunoille */
    z-index: 2;
    text-align: center;
    /* Leveys rajoitetaan, jotta teksti ei levitä itemiä liikaa */
    width: 0; 
    min-width: 80px; 
}

/* Taustaviiva, joka yhdistää pallot */
.likert-line {
    position: absolute;
    top: 32px; 
    /* Viiva alkaa ensimmäisen ja päättyy viimeisen itemin keskelle */
    left: 40px; /* Puolet min-widthistä (80px / 2) */
    right: 40px;
    height: 2px;
    background: #eee;
    z-index: 1;
}

/* Pidetään huoli, että teksti ei pakota itemiä leveämmäksi kuin tarpeen */
.likert-label {
    font-size: 12px;
    line-height: 1.2;
    margin-top: 10px;
    width: 100%;
    word-wrap: break-word;
}

/* Itse pallo (nappi) */
.likert-button {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #ccc;
    background: #fff;
    cursor: pointer;
    margin-bottom: 10px; /* Väli tekstiin */
    transition: all 0.2s ease;
}

.likert-button.active {
    background: #007bff;
    border-color: #0056b3;
}

/* Teksti pallon alla */
.likert-label {
    font-size: 12px;
    line-height: 1.2;
    max-width: 80px; /* Estää tekstejä törmäämästä toisiinsa */
    word-wrap: break-word;
}

/* Taustaviiva, joka yhdistää pallot */
.likert-line {
    position: absolute;
    top: 32px; /* Säädä pallon koon mukaan (puoliväliin palloa) */
    left: 0%; /* Säädä alkamaan ja loppumaan ekasta/vikasta pallosta */
    right: 0%;
    height: 2px;
    background: #eee;
    z-index: 1;
}


/* MOBIILIPÄIVITYS (Alle 600px näytöt) */
@media screen and (max-width: 600px) {
    .likert-container {
        flex-direction: column; /* Muutetaan pystyriveiksi */
        align-items: flex-start;
        padding-left: 20px; /* Tilaa viivalle vasempaan reunaan */
    }

    .likert-item {
        flex-direction: row; /* Pallo ja teksti vierekkäin */
        align-items: center;
        text-align: left;
        width: 100%;
        min-width: auto;
        margin-bottom: 15px;
        min-height: 40px;
    }

    .likert-button {
        margin-bottom: 0;
        margin-right: 15px; /* Väli tekstiin oikealla */
        flex-shrink: 0;
    }

    .likert-label {
        font-size: 14px; /* Suurempi teksti mobiilissa */
        max-width: none;
    }

    .likert-line {
        top: 20px;
        bottom: 35px; /* Viiva loppuu viimeiseen palloon */
        left: 31px;   /* Kohdistetaan pallon keskelle pystysuunnassa */
        width: 2px;
        height: auto;
        right: auto;
    }
}

.question {
    background: #ffffff;
    border-radius: 8px;
    padding: 20px 22px;
    margin-bottom: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.question p {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 16px;
}

/* RESULTS PAGE */

#result-list {
    list-style: none;
    padding: 0;
}

.result-item {
    margin-bottom: 1.5em;
    padding: 1em;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.candidate {
    display: flex;
    gap: 1em;
    align-items: center;
}

.candidate img {
    width: 130px;
    height: 130px;
    object-fit: cover;
    border-radius: 50%;
    margin-left: 1em;
    margin-right: 2em;
}

.score .bar {
    background: #eee;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.score .fill {
    height: 100%;
    background: #4caf50;
}

#office-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 1.5em;
}

.office-tab {
    padding: 8px 14px;
    background: #f0f0f0;
    border-radius: 4px;
    cursor: pointer;
}
.office-tab.active {
    background: #0073aa;
    color: #fff;
}

#results .result-item .candidate .info a {
    color: #000;
}


/* Candidate publish */
.survey-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.publish-btn {
    background: #0073aa;
    color: #fff;
    border: 0;
    padding: 8px 14px;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 1em;

    /* wiggle vain välillä */
    animation: wiggle 5s infinite;
}

.publish-btn:hover {
    background: #005f8d;
    animation: none; /* hoverilla rauhoitetaan */
}

@keyframes wiggle {
    0%   { transform: rotate(0deg); }
    2%   { transform: rotate(-3deg); }
    4%   { transform: rotate(3deg); }
    6%   { transform: rotate(-2deg); }
    8%   { transform: rotate(2deg); }
    10%  { transform: rotate(0deg); }

    /* loppuaika täysin paikallaan */
    100% { transform: rotate(0deg); }
}



/* Progress bar */
#survey-progress {
    margin-bottom: 1.5rem;
}

.survey-progress-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.survey-progress-fill {
    height: 100%;
    width: 0%;
    background: #ff3131; /* punainen */
    transition: width 0.3s ease;
}

.survey-progress-text {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #374151;
    text-align: right;
}

.survey-progress-text {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #374151;
}


/* ================================
   SURVEY INTRO
================================ */

#survey-intro {
    max-width: 520px;
    margin: 2rem auto 3rem;
    padding: 2rem 2.25rem;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0,0,0,.08);
}

#survey-intro h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Label + select layout */
#survey-intro label {
    display: block;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: #111827;
}

#survey-intro select {
    display: block;
    width: 100%;
    margin-top: 0.4rem;
    padding: 0.65rem 0.75rem;
    font-size: 1rem;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background-color: #ffffff;
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, #6b7280 50%),
        linear-gradient(135deg, #6b7280 50%, transparent 50%);
    background-position:
        calc(100% - 18px) calc(50% - 3px),
        calc(100% - 12px) calc(50% - 3px);
    background-size: 6px 6px;
    background-repeat: no-repeat;
}

#survey-intro select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37,99,235,.15);
}

#survey-intro select:disabled {
    background-color: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
}

/* START BUTTON */
#survey-start {
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.75rem 1rem;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 999px;
    border: none;
    background: #2563eb;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
}

#survey-start:hover:not(:disabled) {
    background: #1e4ed8;
    transform: translateY(-1px);
}

#survey-start:active:not(:disabled) {
    transform: translateY(0);
}

#survey-start:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}




/* SURVEY COMPLETE TYYLITTELY, MISSÄ MYÖS SECRET KEY */
.survey-complete {
    max-width: 520px;
    margin: 60px auto;
    text-align: center;
}

.secret-key-box {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 16px 0;
}

.secret-key-box code {
    padding: 8px 12px;
    background: #f1f5f9;
    border-radius: 6px;
    font-size: 15px;
}

.survey-complete .primary {
    background: #2563eb;
    color: #fff;
    border: 0;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
}


/* QUESTION AND ANSWER NOTES */ 
.question-note {
    margin-top: 0.5rem;
}

.question-note textarea {
    width: 100%;
    min-height: 80px;
    resize: vertical;
    font-size: 0.9rem;
}

.answer-note {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #f7f7f7;
    border-left: 3px solid #ccc;
    font-size: 0.9rem;
}

.tooltip-icon {
    position: relative;
    display: inline-block;
    cursor: pointer;
    margin-left: 6px;
    color: #6c757d;
}

/* Tooltip box */
.tooltip-icon .tooltip-text {
    visibility: hidden;
    opacity: 0;
    width: max-content;
    max-width: 220px;
    background-color: #222;
    color: #fff;
    text-align: left;
    padding: 6px 10px;
    border-radius: 6px;

    position: absolute;
    z-index: 999;
    left: 120%;
    top: 50%;
    transform: translateY(-50%);

    font-size: 0.85rem;
    line-height: 1.2;

    transition: opacity 0.2s ease;
    white-space: normal;
}

/* Arrow */
.tooltip-icon .tooltip-text::before {
    content: "";
    position: absolute;
    top: 50%;
    right: 100%;
    transform: translateY(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: transparent #222 transparent transparent;
}

/* Hover effect */
.tooltip-icon:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Matching page: BLURRED RESULTS FOR NON-PAID USERS */
.result-item.blurred {
    position: relative;
}

.candidate-blurred {
    filter: blur(6px);
    pointer-events: none;
}

.results-cta {
    list-style: none;
    margin: 20px 0;
}


.results-cta .results-cta-box .unlock-btn {
    background-color: #4caf50;
    color: #fff;
}


.results-cta-box {
    background: #f5f5f5;
    border: 2px dashed #ccc;
    padding: 20px;
    text-align: center;
    border-radius: 8px;
}

.candidate-blurred {
    filter: blur(6px);
    pointer-events: none;
}


.unlock-btn {
    margin-top: 10px;
    padding: 8px 14px;
    background: #000;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
}




/* Jo vastattu kysely paid_user ilmoitus */
/* Tee election-survey:sta relative jotta absolute toimii */
#election-survey {
    position: relative;
}

/* Overlay sisällä election-survey */ 
#election-survey .survey-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 5; /* alle notice-divin */
}

/* Olemassa oleva huomautus */
#election-survey .survey-existing-notice {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    z-index: 999; /* overlayn yläpuolella */
    max-width: 400px;
    width: 90%;
    text-align: center;
}



/* Taustatiedot Kyselyn tyylittely */
/* =========================
   BACKGROUND SURVEY (LIGHT UI)
========================= */

#survey-background {
    max-width: 720px;
    margin: 0 auto;
    padding: 20px;
}

/* Intro */
.background-intro {
    text-align: center;
    margin-bottom: 25px;
}

.background-intro h2 {
    margin-bottom: 5px;
}

.background-intro p {
    color: #666;
    font-size: 14px;
}

/* Step container */
.background-step {
    animation: fadeIn 0.25s ease;
}

/* Question block */
.bg-question {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 8px;
    background: #fafafa;
}

.bg-question p {
    font-weight: 600;
    margin-bottom: 10px;
}

/* Inputs */
.bg-question label {
    display: block;
    margin-bottom: 6px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.4;
}

/* Radio & checkbox spacing */
.bg-question input[type="radio"],
.bg-question input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.05);
    cursor: pointer;
}

/* Hover effect */
.bg-question label:hover {
    background: #f0f4f8;
    border-radius: 4px;
    padding-left: 4px;
}

/* Navigation */
.background-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.background-nav button {
    padding: 5px 25px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 500;
} 

/* Secondary */
#bg-prev {
    background: #e5e7eb;
    color: #333;
    border-radius: 0; 
    border: 1px solid #000;   
    /*
    background: #e5e7eb;
    color: #333;
    */
}

/* Primary */ 
#bg-next {
    background: #e5e7eb;
    color: #333;
    border-radius: 0; 
    border: 1px solid #000;   
    /*
    background: #0073aa;
    color: #fff;
    */
}
#bg-next:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.6;
    border: 1px solid #e5e7eb;
    box-shadow: none;
    transform: none;
}

#bg-next:hover {
    background: #e5e7eb;
    color: #333;
}

/* taustatietojen error notification */
.bg-question-invalid {
    border-left: 4px solid #dc3545;
    padding-left: 12px;
}

.bg-required-notice {
    margin-top: 8px;
    color: #dc3545;
    font-size: 14px;
    font-weight: 600;
}
/* REQUIRED */
.bg-question[data-required="true"] p::after {
    content: " *";
    color: #dc3545;
}

/* INVALID */
.bg-question-invalid {
    border-left: 4px solid #dc3545;
    padding-left: 12px;
    transition: ease 0.5s all;
}

.bg-required-notice {
    margin: 4px 0 10px;
    color: #dc3545;
    font-size: 14px;
    font-weight: 600;
}
/*
.bg-required-notice {
    margin: 6px 0 12px;
    padding: 8px 10px;
    background: #fff3f3;
    border: 1px solid #f1b0b7;
    border-radius: 6px;
    color: #b42318;
    font-size: 13px;
    font-weight: 600;
}
*/

/* VALID */
.bg-question-valid {
    border-left: 4px solid #28a745;
    padding-left: 12px;
    transition: ease 0.5s all;
}

/* ERROR MESSAGE */
.bg-required-notice {
    margin-top: 8px;
    color: #dc3545;
    font-size: 14px;
    font-weight: 600;
}

/* Footer */ 
.bg-footer {
    margin-top: 25px;
    font-size: 12px;
    color: #777;
    text-align: center;
    line-height: 1.5;
}

/* Simple fade */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* Results page */
.page-template-results-page .candidate-office {
    width: 100%;
    display: block;
    margin-bottom: 5px;    
}

@media (max-width: 500px) {

    body.page-template-results-page .candidate {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    body.page-template-results-page .candidate img {
        margin: 0 0 0 0;
    }

    body.page-template-results-page .candidate .info {
        width: 100%;
    }

}