/* ==========================================
   CAST MEMBERS PORTAL
   VOTING
========================================== */

.cast-voting-wrapper {
    width: 100%;
    max-width: 1150px;
    margin: 30px auto;
}


/* ==========================================
   ELECTION HEADER
========================================== */

.cast-election-header {
    position: relative;
    overflow: hidden;

    padding: 28px;

    margin-bottom: 24px;

    border-radius: 20px;

    background:
        linear-gradient(
            135deg,
            var(--cast-primary),
            var(--cast-primary-dark)
        );

    color: #ffffff;

    box-shadow:
        0 12px 34px rgba(11, 77, 184, 0.20);
}


.cast-election-header::before {
    content: "";

    position: absolute;

    width: 180px;
    height: 180px;

    right: -50px;
    top: -80px;

    border-radius: 50%;

    background:
        rgba(255, 255, 255, 0.06);
}


.cast-election-header h2 {
    position: relative;

    margin: 0 0 8px;

    color: #ffffff;

    font-size: 28px;
    font-weight: 800;
}


.cast-election-header p {
    position: relative;

    margin: 5px 0;

    color:
        rgba(255, 255, 255, 0.88);

    font-size: 13px;
    line-height: 1.6;
}


/* ==========================================
   POSITION CARD
========================================== */

.cast-ballot-position {
    padding: 24px;

    margin-bottom: 22px;

    background: #ffffff;

    border:
        1px solid var(--cast-border);

    border-radius: 18px;

    box-shadow:
        0 5px 22px rgba(0, 0, 0, 0.045);
}


.cast-ballot-position h3 {
    margin: 0 0 6px;

    color:
        var(--cast-text);

    font-size: 21px;
    font-weight: 800;
}


.cast-ballot-position > p {
    margin: 0 0 18px;

    color:
        var(--cast-muted);

    font-size: 13px;
}


/* ==========================================
   CANDIDATE GRID
========================================== */

.cast-candidate-grid {
    display: grid !important;

    grid-template-columns:
        repeat(
            auto-fit,
            minmax(210px, 1fr)
        ) !important;

    gap: 16px !important;

    margin-bottom: 10px !important;
}


/* ==========================================
   CANDIDATE CARD
========================================== */

.cast-candidate-card {
    position: relative;

    display: block;

    padding: 14px !important;

    cursor: pointer;

    background: #ffffff;

    border:
        2px solid var(--cast-border) !important;

    border-radius: 16px;

    text-align: center;

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}


.cast-candidate-card:hover {
    transform: translateY(-2px);

    border-color:
        var(--cast-primary) !important;

    box-shadow:
        var(--cast-shadow-hover);
}


/* ==========================================
   CANDIDATE PHOTO
========================================== */

.cast-candidate-photo {
    overflow: hidden;

    border-radius: 13px;

    background:
        var(--cast-bg);

    margin-bottom: 12px;
}


.cast-candidate-photo img,
.cast-candidate-card img {
    display: block;

    width: 100% !important;

    aspect-ratio: 1 / 1;

    object-fit: cover;

    border-radius: 13px;
}


/* ==========================================
   CANDIDATE NAME
========================================== */

.cast-candidate-card h4 {
    margin: 10px 0 6px;

    color:
        var(--cast-text);

    font-size: 16px;
    font-weight: 800;

    line-height: 1.3;
}


/* ==========================================
   MANIFESTO / DESCRIPTION
========================================== */

.cast-candidate-card > p {
    margin: 6px 0;

    color:
        var(--cast-muted);

    font-size: 12px;
    line-height: 1.5;
}


/* ==========================================
   RADIO / CHECKBOX
========================================== */

.cast-candidate-card
input[type="radio"],
.cast-candidate-card
input[type="checkbox"] {
    width: 18px;
    height: 18px;

    margin-right: 6px;

    vertical-align: middle;

    accent-color:
        var(--cast-primary);
}


/* ==========================================
   SELECTED CARD
   Works in modern browsers
========================================== */

.cast-candidate-card:has(
    input[type="radio"]:checked
),
.cast-candidate-card:has(
    input[type="checkbox"]:checked
) {
    border-color:
        var(--cast-primary) !important;

    background:
        var(--cast-primary-light);

    box-shadow:
        0 8px 24px rgba(11, 77, 184, 0.10);
}


/* ==========================================
   SELECTION LABEL
========================================== */

.cast-candidate-card
input[type="radio"]:checked,
.cast-candidate-card
input[type="checkbox"]:checked {
    accent-color:
        var(--cast-primary);
}


/* ==========================================
   FINAL CONFIRMATION AREA
========================================== */

.cast-voting-wrapper form > div:last-child {
    padding: 20px !important;

    margin-top: 25px !important;

    background: #ffffff;

    border:
        1px solid var(--cast-border);

    border-radius: 16px;

    box-shadow:
        0 5px 20px rgba(0, 0, 0, 0.04);
}


.cast-voting-wrapper
input[name="vote_confirmation"] {
    width: 18px;
    height: 18px;

    margin-right: 7px;

    accent-color:
        var(--cast-primary);
}


/* ==========================================
   SUBMIT VOTE BUTTON
========================================== */

.cast-voting-wrapper
button[type="submit"] {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    padding: 13px 22px;

    border: 0;

    border-radius: 11px;

    background:
        var(--cast-primary);

    color: #ffffff;

    font-size: 14px;
    font-weight: 800;

    cursor: pointer;

    transition: 0.2s ease;
}


.cast-voting-wrapper
button[type="submit"]:hover {
    background:
        var(--cast-primary-dark);

    transform: translateY(-1px);
}


/* ==========================================
   SUCCESS / ALREADY VOTED
========================================== */

.cast-voting-wrapper
.cast-portal-message h3 {
    margin-top: 0;

    margin-bottom: 6px;

    font-size: 18px;
}


/* ==========================================
   NO CANDIDATES
========================================== */

.cast-ballot-position
> p:last-child {
    color:
        var(--cast-muted);
}


/* ==========================================
   TABLET
========================================== */

@media (max-width: 768px) {

    .cast-voting-wrapper {
        margin: 15px auto;
    }


    .cast-election-header {
        padding: 22px;

        border-radius: 17px;
    }


    .cast-election-header h2 {
        font-size: 23px;
    }


    .cast-ballot-position {
        padding: 19px;

        border-radius: 15px;
    }


    .cast-candidate-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr)) !important;
    }

}


/* ==========================================
   MOBILE
========================================== */

@media (max-width: 520px) {

    .cast-election-header {
        padding: 18px;
    }


    .cast-election-header h2 {
        font-size: 20px;
    }


    .cast-election-header p {
        font-size: 12px;
    }


    .cast-ballot-position {
        padding: 16px;
    }


    .cast-ballot-position h3 {
        font-size: 18px;
    }


    .cast-candidate-grid {
        grid-template-columns: 1fr 1fr !important;

        gap: 10px !important;
    }


    .cast-candidate-card {
        padding: 10px !important;

        border-radius: 13px;
    }


    .cast-candidate-photo {
        border-radius: 10px;
    }


    .cast-candidate-photo img,
    .cast-candidate-card img {
        border-radius: 10px;
    }


    .cast-candidate-card h4 {
        font-size: 13px;
    }


    .cast-candidate-card > p {
        font-size: 10px;
    }


    .cast-candidate-card
    input[type="radio"],
    .cast-candidate-card
    input[type="checkbox"] {
        width: 16px;
        height: 16px;
    }


    .cast-voting-wrapper
    button[type="submit"] {
        width: 100%;
    }

}