/* 
 * Voting Portal 'Boresha' Modernization
 * High-Density, Premium, Glassmorphic Aesthetic
 */

:root {
    --vote-glass-white: rgba(255, 255, 255, 0.85);
    --vote-glass-navy: rgba(12, 26, 50, 0.95);
    --vote-gold-glow: 0 0 35px rgba(201, 164, 65, 0.6);
    --vote-cyber-gold: #c9a441;
    --vote-primary-navy: #0c1a32;
    /* Redefining for Blue-White Request */
    --vote-navy-gradient: linear-gradient(180deg, #0c1a32 0%, #162a4d 40%, #f1f5f9 100%);
}

/* --- PORTAL ENTRY (LOGIN) --- */
#studentCode {
    background-image: var(--vote-mesh-bg), var(--vote-navy-gradient) !important;
    background-color: var(--vote-primary-navy) !important;
    /* Fallback */
    background-attachment: fixed !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 2000 !important;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 40px 15px !important;
}

/* Body background handled by global theme or specific page containers to avoid conflicts */

.page-container {
    background-image: var(--vote-mesh-bg), var(--vote-navy-gradient) !important;
    background-attachment: fixed !important;
    background-size: cover;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Center vertically */
    padding: 40px 0;
    /* Add vertical padding for scrolling content */
}

.vote-wrapper {
    width: 100%;
    max-width: 800px;
    /* Tighter constraint for centered look */
    margin: 0 auto;
    padding: 0 15px 140px 15px;
    /* Added 140px bottom padding to clear buttons */
}

.login-container {
    background: var(--vote-glass-white) !important;
    backdrop-filter: blur(25px) !important;
    -webkit-backdrop-filter: blur(25px) !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    border-radius: 40px !important;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.2) !important;
    max-width: 500px;
    width: 100%;
    padding: 40px 35px !important;
    animation: fadeInUp 0.8s cubic-bezier(0.19, 1, 0.22, 1) !important;
    position: relative;
}

.voting-logo {
    width: 100px;
    height: 100px;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.1));
    animation: floating 4s ease-in-out infinite;
}

#votingCodeInput {
    height: 60px !important;
    font-size: 1.6rem !important;
    letter-spacing: 12px;
    border-radius: 18px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    text-align: center;
    font-weight: 900;
    color: var(--primary-color);
    border: 2px solid transparent !important;
    transition: all 0.3s ease !important;
}

#votingCodeInput:focus {
    border-color: var(--secondary-color) !important;
    box-shadow: var(--vote-gold-glow) !important;
    transform: scale(1.02);
}

.guidelines-box {
    background: rgba(15, 33, 71, 0.03);
    border-radius: 20px;
    padding: 18px;
    border: 1px solid rgba(15, 33, 71, 0.05);
}

/* --- CANDIDATE CARDS --- */
/* .party-group-divider handled via dynamic grouping */

/* More Compact Candidate Card */
.candidate {
    background: var(--vote-glass-white);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    padding: 10px;
    width: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    transform-style: flat !important;
    /* Disabling 3D for stability */
    perspective: none !important;
    will-change: auto !important;
    height: auto;
    min-height: 140px;
}

/* Move selection area (check) to overlay or bottom right */
.joint-selection-area {
    position: absolute;
    top: 8px;
    right: 8px;
}

.radio {
    width: 24px;
    height: 24px;
}

.check {
    font-size: 14px;
}

/* Profile Layout - Tighter */
.joint-profiles {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    margin-top: 5px;
}

.profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 48%;
    /* fit two side by side */
}

/* Circular, smaller images */
.joint-img-wrap {
    width: 70px;
    /* Reduced from larger size */
    height: 70px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 6px;
    border: 2px solid #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.joint-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* New Logic for Label/Name placement */
.joint-role {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--secondary-color);
    font-weight: 700;
    margin-bottom: 2px;
    background: rgba(201, 164, 65, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
}

.joint-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--vote-primary-navy);
    line-height: 1.2;
    max-width: 100%;
}

.candidate-content {
    transform: translateZ(20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.candidate::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background: linear-gradient(to right, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    transform: skewX(-25deg);
    transition: 0.8s;
    pointer-events: none;
    z-index: 2;
}

.candidate:hover::after {
    left: 100%;
}

.candidate:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    border-color: var(--secondary-color);
    background: rgba(255, 255, 255, 0.9);
}

.candidate.selected-item::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--gold-gradient);
    border-radius: 22px;
    z-index: -1;
    animation: goldGlow 2s infinite ease-in-out;
}

@keyframes goldGlow {

    0%,
    100% {
        opacity: 0.5;
        box-shadow: 0 0 20px rgba(201, 164, 65, 0.4);
    }

    50% {
        opacity: 1;
        box-shadow: 0 0 40px rgba(201, 164, 65, 0.8);
    }
}

.candidate-img img {
    border-radius: 18px;
    width: 75px;
    height: 75px;
    object-fit: cover;
    border: 3px solid var(--white);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

.candidate:hover .candidate-img img {
    border-radius: 50%;
    transform: scale(1.1) rotate(-5deg);
    border-color: var(--secondary-color);
}

.candidate-name p:first-child {
    font-size: 1rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 2px;
}

.candidate-name p.small {
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
}

.candidate:hover .joint-img {
    border-color: var(--secondary-color);
    transform: scale(1.05);
}

.candidate.selected-item .joint-img {
    border-color: var(--secondary-color);
    box-shadow: 0 0 15px rgba(201, 164, 65, 0.4);
}

/* --- COMPACT CARD STYLE (Phase 10) --- */
.compact-card {
    background: var(--vote-glass-white);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    min-height: 220px;
    justify-content: space-between;
}

.compact-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Avatar Grouping */
.avatar-group {
    position: relative;
    height: 80px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.avatar-wrapper.primary img {
    width: 70px;
    height: 70px;
    border: 3px solid white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    z-index: 2;
    position: relative;
    object-fit: cover;
}

.avatar-wrapper.mate img {
    width: 50px;
    height: 50px;
    border: 2px solid white;
    position: absolute;
    bottom: 0;
    right: 50%;
    transform: translateX(45px);
    /* Offset to right */
    z-index: 3;
    object-fit: cover;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.name-primary {
    color: var(--vote-primary-navy);
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.party-badge {
    background: rgba(12, 26, 50, 0.05);
    color: var(--vote-primary-navy);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
    display: inline-block;
}

/* Custom Visible Radio */
.selection-footer {
    width: 100%;
    display: flex;
    justify-content: center;
}

.custom-radio {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #cbd5e0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s ease;
}

.compact-card.selected-item .custom-radio {
    background: var(--gold-gradient);
    border-color: var(--vote-cyber-gold);
    box-shadow: 0 0 10px rgba(201, 164, 65, 0.5);
    transform: scale(1.1);
}

.compact-card.selected-item {
    border: 2px solid var(--vote-cyber-gold) !important;
    background: rgba(255, 255, 255, 0.95);
}

/* --- DASHBOARD CARD STYLE --- */
.dashboard-card {
    background: var(--vote-glass-white);
    backdrop-filter: blur(10px);
    cursor: pointer;
}

.dashboard-card:hover {
    background: white;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

/* --- SELECTION STATE --- */
.candidate.selected-item {
    border: 2px solid var(--vote-cyber-gold) !important;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 15px rgba(201, 164, 65, 0.15);
    transform: translateY(-2px);
}

.dashboard-card {
    transition: all 0.2s ease-out;
    border-radius: 12px !important;
    /* Smaller radius */
    border: 1px solid rgba(12, 26, 50, 0.05);
}

.selection-badge {
    width: 24px;
    height: 24px;
    background: var(--gold-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--vote-primary-navy);
    font-size: 12px;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.selection-badge.visible {
    opacity: 1;
    transform: scale(1);
}

/* Remove old radio */
.radio,
.check {
    display: none !important;
}

.candidate.selected-item .check,
.check.checked {
    color: var(--primary-color) !important;
    opacity: 1 !important;
    transform: rotate(360deg);
}

/* --- VOTING JOURNEY & HEADER --- */
.voting-journey {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: var(--vote-glass-navy);
    backdrop-filter: blur(20px);
    padding: 10px 25px;
    border-radius: 50px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}

.voting-journey.show {
    opacity: 1;
}

.journey-step {
    position: relative;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.journey-step::after {
    content: none !important;
    /* Hide duplicating text labels */
    position: absolute;
    bottom: -22px;
    font-size: 0.6rem;
    white-space: nowrap;
    text-transform: uppercase;
    font-weight: 900;
    color: white;
    opacity: 0;
    transform: translateY(5px);
    transition: 0.4s;
    letter-spacing: 1px;
}

.journey-step.active::after {
    opacity: 1;
    transform: translateY(0);
    color: var(--secondary-color);
}

.journey-step.active {
    background: var(--secondary-color);
    transform: scale(1.6);
    box-shadow: var(--vote-gold-glow);
    animation: stepPulse 2s infinite;
}

.journey-step.completed {
    background: var(--white);
    opacity: 0.8;
}

/* Refined Header Container (Glass Pill) */
.disabled-page {
    margin: 80px auto 20px !important;
    /* Increased top margin to clear fixed Journey Bar */
    max-width: 600px !important;
    /* Tighter constraint */
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(20px);
    border-radius: 50px !important;
    /* Pill Shape */
    padding: 10px 20px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.6);
    text-align: center;
    position: relative;
    z-index: 10;
}

#candidatePositionName {
    font-size: 1.1rem;
    /* Further reduced from 1.3rem */
    font-weight: 800;
    color: var(--vote-primary-navy);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 2px;
    text-shadow: none;
    /* Cleaner look */
    line-height: 1.2;
}

.selection-status-badge {
    background: var(--gold-gradient);
    color: var(--primary-color);
    padding: 5px 15px;
    /* Reduced padding */
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.75rem;
    /* Reduced size */
    display: inline-flex;
    align-items: center;
    box-shadow: 0 4px 15px rgba(201, 164, 65, 0.3);
    margin-top: 5px;
}

/* --- UTILITY BUTTONS (ADMIN & GRAPH) --- */
.showzz {
    position: fixed;
    top: 25px;
    right: 30px;
    z-index: 2005;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--secondary-color);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    font-size: 1.2rem;
    -webkit-tap-highlight-color: transparent;
}

.showzz.graph {
    right: 95px;
}

.showzz.home-btn {
    left: 30px !important;
    right: auto !important;
}

.showzz:hover {
    background: var(--secondary-color);
    color: var(--primary-color);
    transform: scale(1.1) rotate(10deg);
    box-shadow: var(--vote-gold-glow);
}

@media (hover: none) {
    .showzz:active {
        background: var(--secondary-color);
        color: var(--primary-color);
        transform: scale(0.95);
    }
}

/* --- THE ULTIMATE VIEWPORT LOCK --- */
html.booth-active,
body.booth-active {
    height: 100% !important;
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
}

#boothScrollingContainer {
    height: 100% !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 120px;
    /* Space for fixed buttons */
}

.voting-actions-fixed {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 2147483647 !important;
    pointer-events: none !important;
    display: none;
    justify-content: center !important;
    align-items: flex-end !important;
    padding-bottom: env(safe-area-inset-bottom, 25px) !important;
    padding-top: 10px;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.95), transparent 60%);
    contain: layout style;
    transform: translateZ(0);
    /* Force GUI layer */
}

.next-prev {
    pointer-events: auto !important;
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(25px) !important;
    -webkit-backdrop-filter: blur(25px) !important;
    padding: 10px 18px !important;
    border-radius: 100px !important;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    display: flex !important;
    gap: 12px !important;
    width: max-content !important;
    min-height: 54px !important;
    align-items: center !important;
    margin-bottom: 5px;
    /* Added small gap from the very bottom safe area */
}

.next-prev button {
    border-radius: 50px;
    padding: 12px 28px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.8rem;
    border: none;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#prev {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

#next {
    background: linear-gradient(135deg, var(--primary-color), #2563eb);
    color: white;
    box-shadow: 0 6px 15px rgba(37, 99, 235, 0.3);
}

#submitBtn {
    background: linear-gradient(90deg, #10b981, #34d399, #10b981);
    background-size: 200% auto !important;
    animation: shimmer 3s linear infinite !important;
    color: white;
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.3);
    transform: none !important;
    /* Force no transform */
}

#prev:hover:not(:disabled):not(.disabled-button) {
    background: #e2e8f0;
    color: var(--primary-color);
    transform: translateX(-3px);
}

#next:hover:not(:disabled):not(.disabled-button) {
    transform: scale(1.05) translateX(3px);
    filter: brightness(1.05);
    box-shadow: 0 8px 25px rgba(15, 33, 71, 0.25);
}

#submitBtn:hover:not(:disabled):not(.disabled-button) {
    filter: brightness(1.1);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

#submitBtn:disabled,
#submitBtn.disabled-button {
    filter: grayscale(1) opacity(0.5);
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Shimmer Effect Definition */
.shimmer-btn {
    position: relative;
    overflow: hidden;
}

.shimmer-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(to right,
            transparent,
            rgba(255, 255, 255, 0.4),
            transparent) !important;
    transform: rotate(30deg);
    animation: shimmerEffect 2s infinite;
    pointer-events: none;
}

@keyframes shimmerEffect {
    0% {
        transform: translate(-100%, -100%) rotate(30deg);
    }

    100% {
        transform: translate(100%, 100%) rotate(30deg);
    }
}

@media (max-width: 576px) {
    .voting-actions-fixed {
        bottom: 0 !important;
        padding-bottom: env(safe-area-inset-bottom, 15px) !important;
    }

    .next-prev {
        width: 90% !important;
        padding: 8px 12px !important;
    }

    .next-prev button {
        padding: 7px 15px;
        font-size: 0.65rem;
        letter-spacing: 1px;
    }

    .selection-status-badge {
        font-size: 0.65rem;
        padding: 4px 12px;
        margin-top: 10px;
        max-width: 90%;
        display: inline-flex;
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }
}

/* --- BALLOT REVIEW --- */
.review-container {
    max-width: 600px;
    /* narrowed for receipt look */
    margin: 60px auto 160px;
    background: #fff;
    padding: 40px 30px 60px;
    /* extra bottom padding for jagged edge */
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    /* Jagged Edge using mask or radial-gradient */
    --mask: radial-gradient(10px at 50% 13px, #000 99%, #0000 101%) calc(50% - 15px) 0/30px 51% repeat-x,
        radial-gradient(10px at 50% -3px, #0000 99%, #000 101%) 50% 15px/30px calc(100% - 15px) repeat-x;
    -webkit-mask: var(--mask);
    mask: var(--mask);
    font-family: 'Courier New', Courier, monospace;
    /* Tech/Receipt font */
}

/* Texture overlay for paper feel */
.review-container::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0IiBoZWlnaHQ9IjQiPgo8cmVjdCB3aWR0aD0iNCIgaGVpZ2h0PSI0IiBmaWxsPSIjZmZmIi8+CjxyZWN0IHdpZHRoPSIxIiBoZWlnaHQ9IjEiIGZpbGw9IiNjY2MiIG9wYWNpdHk9IjAuMSIvPgo8L3N2Zz4=');
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

.review-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-30deg);
    font-size: 5rem;
    font-weight: 900;
    color: rgba(0, 0, 0, 0.03);
    pointer-events: none;
    text-transform: uppercase;
    white-space: nowrap;
    z-index: 0;
}

.review-header-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    filter: grayscale(100%);
    opacity: 0.8;
}

.receipt-divider {
    border-top: 2px dashed #cbd5e1;
    margin: 20px 0;
    width: 100%;
}

.review-title {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 30px;
    letter-spacing: -1px;
}

.review-item {
    display: flex;
    align-items: center;
    padding: 20px 30px;
    background: #f8fafc;
    border-radius: 24px;
    margin-bottom: 15px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.review-item:hover {
    background: white;
    border-color: var(--secondary-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.review-pos {
    width: 250px;
    flex-shrink: 0;
    font-weight: 900;
    color: #64748b;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.review-can {
    flex-grow: 1;
    font-weight: 800;
    color: var(--primary-color);
    font-size: 1rem;
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
}

.review-can.empty {
    color: #94a3b8;
    font-style: italic;
    font-weight: 600;
}

@media (max-width: 768px) {
    .review-container {
        padding: 30px 20px 150px;
        margin: 60px 10px 120px;
        border-radius: 30px;
    }

    .review-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px 20px;
    }

    .review-pos {
        width: 100%;
        margin-bottom: 5px;
    }

    .review-can {
        font-size: 1rem;
    }

    .review-title {
        font-size: 1.6rem;
    }

    #candidateWrapper {
        padding-bottom: 150px !important;
    }

    .review-container {
        margin-bottom: 130px !important;
    }
}

/* --- JOINT TICKET --- */
.candidate-joint {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 20px !important;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.95));
}

.joint-header {
    width: 100%;
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 2px solid rgba(214, 181, 95, 0.2);
    padding-bottom: 12px;
}

.joint-header h5 {
    font-weight: 900;
    color: var(--primary-color);
    margin: 0;
    text-transform: uppercase;
    font-size: 1rem;
    letter-spacing: 1.5px;
    background: linear-gradient(135deg, var(--primary-color), #1a3a7a);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.joint-profiles {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 20px;
    position: relative;
    margin-bottom: 20px;
}

.profile-card {
    flex: 1;
    text-align: center;
    max-width: 140px;
}

.joint-img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    object-fit: cover;
    margin-bottom: 10px;
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    position: relative;
    z-index: 2;
}

.joint-img-wrap {
    position: relative;
    display: inline-block;
}

.joint-img-wrap::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border-radius: 50%;
    background: var(--gold-gradient);
    opacity: 0;
    transition: all 0.4s ease;
    z-index: 1;
    transform: scale(0.9);
}

.candidate:hover .joint-img-wrap::before,
.candidate.selected-item .joint-img-wrap::before {
    opacity: 1;
    transform: scale(1);
    box-shadow: var(--vote-gold-glow);
}

.joint-name {
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--primary-color);
    line-height: 1.3;
}

.joint-role {
    font-size: 0.6rem;
    /* Reduced from 0.68rem */
    text-transform: uppercase;
    background: rgba(15, 33, 71, 0.08);
    padding: 3px 10px;
    border-radius: 20px;
    display: inline-block;
    font-weight: 700;
}

.joint-party {
    position: absolute;
    bottom: 20px;
    right: 20px;
    font-size: 0.62rem;
    font-weight: 900;
    background: var(--gold-gradient);
    padding: 4px 14px;
    border-radius: 30px;
}

@media (max-width: 576px) {
    .joint-img {
        width: 65px;
        height: 65px;
    }
}

/* --- JOINT & UNIFORM LAYOUT ENHANCEMENTS --- */
.joint-profiles.single-profile {
    justify-content: center;
}

.joint-profiles.single-profile .profile-card {
    max-width: 180px;
}

.joint-img-wrap {
    position: relative;
    display: inline-block;
}

.joint-img-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

/* --- ENHANCED BALLOT REVIEW --- */
.review-position-group {
    background: white;
    border-radius: 30px;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(15, 33, 71, 0.08);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.review-pos-header {
    background: #f8fafc;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.review-pos-header h6 {
    margin: 0;
    font-weight: 900;
    color: var(--primary-color);
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.review-candidates-container {
    padding: 20px 25px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.review-selection-box {
    background: #fff;
    border: 2px solid #f1f5f9;
    border-radius: 20px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
    min-width: 250px;
    flex: 1 1 auto;
}

.review-selection-box:hover {
    border-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.review-selection-box.empty {
    border-style: dashed;
    background: rgba(241, 245, 249, 0.5);
    justify-content: center;
    padding: 25px;
}

.review-profiles {
    display: flex;
    gap: 12px;
}

.profile-card.mini {
    text-align: center;
}

.joint-img.mini {
    width: 45px;
    height: 45px;
    border-width: 2px;
    margin-bottom: 4px;
}

.joint-name.small {
    font-size: 0.75rem;
    font-weight: 800;
}

.review-party-tag {
    margin-left: auto;
    font-size: 0.65rem;
    font-weight: 900;
    background: #f8fafc;
    padding: 4px 12px;
    border-radius: 50px;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

@media (max-width: 576px) {
    .review-selection-box {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .review-party-tag {
        margin: 5px 0 0;
    }

    .review-candidates-container {
        padding: 15px;
    }
}

/* --- ANIMATIONS --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes stepPulse {
    0% {
        transform: scale(1.6);
        box-shadow: 0 0 0 0 rgba(214, 181, 95, 0.6);
    }

    70% {
        transform: scale(1.7);
        box-shadow: 0 0 0 15px rgba(214, 181, 95, 0);
    }

    100% {
        transform: scale(1.6);
        box-shadow: 0 0 0 0 rgba(214, 181, 95, 0);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes floating {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

@keyframes selectionPulse {
    0% {
        transform: scale(1.02);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 30px rgba(201, 164, 65, 0.6);
    }

    100% {
        transform: scale(1.02);
    }
}

.reveal {
    animation: fadeInUp 0.8s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

/* --- PHASE 3: PARTY GROUPING & STATIONARY BUTTONS --- */
.party-group-divider {
    position: relative;
    padding-top: 10px;
}

.party-label-container {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.party-label-badge {
    background: var(--primary-color);
    color: white;
    padding: 6px 16px;
    /* Reduced */
    border-radius: 50px;
    font-size: 0.75rem;
    /* Reduced from 0.8rem */
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    box-shadow: 0 4px 10px rgba(15, 33, 71, 0.2);
    white-space: nowrap;
    border: 2px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
}

.party-label-line {
    flex-grow: 1;
    height: 2px;
    background: linear-gradient(to right, var(--primary-color), transparent);
    opacity: 0.15;
}

/* refined buttons */
.next-prev button {
    background: var(--vote-primary-navy);
    color: white;
    border: none;
    padding: 10px 25px;
    /* Reduced padding */
    border-radius: 50px;
    font-size: 0.85rem;
    /* Smaller font */
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 5px 15px rgba(12, 26, 50, 0.15);
    /* Softer shadow */
    transition: all 0.3s ease;
    min-width: 120px;
    /* Reduced min-width */
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.next-prev button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(12, 26, 50, 0.25);
    background: var(--vote-glass-navy);
}

#submitBtn {
    background: var(--gold-gradient) !important;
    color: var(--vote-primary-navy) !important;
    box-shadow: 0 5px 20px rgba(201, 164, 65, 0.3) !important;
    min-width: 140px !important;
}

/* Hide redundant position headers in candidate boxes */
.candidate-joint .joint-header {
    display: none;
}

/* Mobile specific labels for grouped view */
@media (max-width: 768px) {
    .party-label-badge {
        font-size: 0.7rem;
        padding: 6px 15px;
    }
}

/* --- VOTER INSTRUCTION BAR --- */
#voterInstructionBar {
    background: rgba(15, 33, 71, 0.85);
    backdrop-filter: blur(10px);
    color: white;
    padding: 8px 20px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 10px auto;
    max-width: 600px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 100;
    animation: fadeInUp 0.5s ease-out;
}

/* --- SLIDE ANIMATIONS --- */
.slide-out-left {
    animation: slideOutLeft 0.5s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

.slide-in-right {
    animation: slideInRight 0.5s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

.slide-out-right {
    animation: slideOutRight 0.5s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

.slide-in-left {
    animation: slideInLeft 0.5s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

@keyframes slideOutLeft {
    to {
        transform: translateX(-100px);
        opacity: 0;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    to {
        transform: translateX(100px);
        opacity: 0;
    }
}

/* --- IMMERSIVE SUCCESS OVERLAY --- */
#successOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(12, 26, 50, 0.98);
    background-image: var(--vote-mesh-bg);
    z-index: 10000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    padding: 20px;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* --- IMMERSIVE SUCCESS OVERLAY --- */
#successOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--vote-navy-gradient);
    z-index: 9999;
    display: none;
    /* Hidden by default */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    padding: 20px;
    backdrop-filter: blur(20px);
}

.success-icon-wrap {
    width: 100px;
    height: 100px;
    background: var(--gold-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin-bottom: 30px;
    box-shadow: 0 0 30px rgba(201, 164, 65, 0.5);
    animation: scaleUp 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.success-title {
    font-weight: 900;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 15px;
    animation: fadeInUp 0.8s ease;
}

.success-message {
    font-size: 1.1rem;
    max-width: 600px;
    opacity: 0.9;
    line-height: 1.6;
    margin-bottom: 30px;
    animation: fadeInUp 1s ease;
}

.redirect-hint {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.6;
    animation: fadeInUp 1.2s ease;
}

@keyframes scaleUp {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* --- IMMERSIVE BOOTH TRANSITION (MODERNIZED) --- */
#boothTransition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--vote-navy-gradient);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    overflow: hidden;
}

.loader-content {
    position: relative;
    z-index: 10;
    padding: 20px;
    width: 100%;
    max-width: 400px;
    animation: fadeInUp 0.8s cubic-bezier(0.19, 1, 0.22, 1);
}

.loader-shield-wrap {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader-shield-wrap i {
    font-size: 4rem;
    color: var(--secondary-color);
    z-index: 2;
    filter: drop-shadow(0 0 20px rgba(201, 164, 65, 0.4));
    animation: shieldPulse 2s infinite ease-in-out;
}

.loader-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid var(--secondary-color);
    border-radius: 50%;
    opacity: 0;
    animation: ringPulse 2s infinite ease-out;
}

.loader-title {
    font-weight: 900;
    letter-spacing: 4px;
    font-size: 1.5rem;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.loader-subtitle {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 2px;
    opacity: 0.6;
    text-transform: uppercase;
    margin-bottom: 30px;
}

.loader-progress-bar {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin: 0 auto;
    overflow: hidden;
}

.loader-progress-fill {
    width: 100%;
    height: 100%;
    background: var(--gold-gradient);
    border-radius: 10px;
    animation: progressIndeterminate 1.5s infinite ease-in-out;
    transform-origin: left;
}

.loader-glow-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(201, 164, 65, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
}

@keyframes shieldPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

@keyframes ringPulse {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

@keyframes progressIndeterminate {
    0% {
        transform: scaleX(0.1) translateX(-100%);
    }

    50% {
        transform: scaleX(0.4) translateX(100%);
    }

    100% {
        transform: scaleX(0.1) translateX(200%);
    }
}

/* Responsive Adjustments for Loader */
@media (max-width: 576px) {
    .loader-title {
        font-size: 1.1rem;
        letter-spacing: 2px;
    }

    .loader-subtitle {
        font-size: 0.65rem;
        letter-spacing: 1px;
    }

    .loader-shield-wrap {
        width: 100px;
        height: 100px;
        margin-bottom: 20px;
    }

    .loader-shield-wrap i {
        font-size: 3rem;
    }

    .loader-progress-bar {
        width: 150px;
    }
}