:root {
    --primary-color: rgb(227, 6, 19);
    --secondary-color: rgb(30, 58, 139);
    --bg-color: rgb(30, 58, 139);
    /* Blue Background */
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(168, 85, 247, 0.15) 0px, transparent 50%);
    color: var(--text-main);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Header */
header {
    text-align: center;
    padding: 3rem 1rem;
    animation: fadeInDown 1s ease-out;
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.back-link {
    position: absolute;
    left: 20px;
    top: 40px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.back-link:hover {
    color: var(--text-main);
}

h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: #ffffff;
    /* White Titles */
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
}

/* Grid */
.candidate-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 2rem 2rem 8rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* Card */
.card {
    background: var(--card-bg);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.card.selected {
    border-color: #22c55e;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.4);
    transform: translateY(-5px);
}

.card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
    /* border-color: rgba(129, 140, 248, 0.5); Removed to simplify interaction */
}

.card-image-wrapper {
    height: auto;
    padding: 1.5rem 1.5rem 0 1.5rem;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
}

.card-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 50%;
    /* Making them circular as it usually looks better with small fixed sizes */
    transition: transform 0.6s ease;
    border: 3px solid var(--primary-color);
}

.card:hover .card-image {
    transform: scale(1.1);
}

.card-content {
    padding: 1.5rem;
    text-align: center;
    position: relative;
    z-index: 1;
}

.card-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    color: #fff;
}

.card-party {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.vote-btn {
    margin-top: 1.5rem;
    padding: 0.75rem 2rem;
    background: var(--primary-color);
    border: none;
    border-radius: 50px;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: opacity 0.3s;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
}

.vote-btn:hover {
    opacity: 0.9;
}

.card.selected .vote-btn {
    background: #22c55e;
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.5);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2.5rem;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal h2 {
    margin-top: 0;
    color: #fff;
}

.modal p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-confirm {
    background: #22c55e;
    /* Green */
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-confirm:hover {
    background: #16a34a;
}

.btn-cancel {
    background: #ef4444;
    /* Red */
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-cancel:hover {
    background: #dc2626;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    color: #0f172a;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: translateY(100px);
    transition: transform 0.3s ease;
    z-index: 2000;
    font-weight: 500;
}

.toast.show {
    transform: translateY(0);
}

.toast.success {
    border-left: 4px solid #22c55e;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

/* Disabled State */
body.voted .card {
    pointer-events: none;
    opacity: 0.5;
    filter: grayscale(1);
}

body.voted .voted-message {
    display: block;
}

.voted-message {
    display: none;
    text-align: center;
    padding: 2rem;
    background: rgba(34, 197, 94, 0.1);
    border-radius: 20px;
    margin: 2rem auto;
    max-width: 600px;
}

/* Sticky Footer */
.sticky-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #0f172a;
    border-top: 1px solid var(--glass-border);
    padding: 1.5rem;
    box-shadow: 0 -10px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sticky-footer.visible {
    transform: translateY(0);
}

.footer-content {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.selection-count {
    font-size: 1.2rem;
    font-weight: bold;
}

.btn-confirm.big {
    font-size: 1.1rem;
    padding: 1rem 2rem;
    background: #22c55e;
}

.btn-confirm.big:disabled {
    background: #475569;
    cursor: not-allowed;
    opacity: 0.7;
}

.voted-message p {
    font-size: 1.5rem;
    color: #22c55e;
    font-weight: bold;
    margin-bottom: 1.5rem;
}

/* Landing Page */
body.landing-page {
    justify-content: center;
    align-items: center;
}

.hero-container {
    text-align: center;
    padding: 2rem;
    animation: fadeInDown 1s ease-out;
}

.hero-logo {
    max-width: 200px;
    height: auto;
    margin-bottom: 2rem;
    filter: drop-shadow(0 0 20px rgba(227, 6, 19, 0.3));
}

.header-logo {
    max-width: 240px;
    height: auto;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.3));
}

.cta-group {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 3rem;
    flex-wrap: wrap;
}

.cta-button {
    display: inline-block;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    transition: transform 0.2s, opacity 0.2s, box-shadow 0.2s;
}

.cta-button.primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 0 20px rgba(230, 0, 20, 0.4);
}

.cta-button.secondary {
    background: #ffffff;
    color: var(--secondary-color);
    border: 2px solid #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.cta-button.secondary:hover {
    background: #f1f5f9;
    color: var(--secondary-color);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
}

.cta-button.small {
    padding: 0.5rem 1.5rem;
    font-size: 0.9rem;
}

.cta-button:hover {
    transform: translateY(-3px);
    opacity: 0.9;
}

.cta-button.primary:hover {
    box-shadow: 0 0 30px rgba(230, 0, 20, 0.6);
}

/* Results Page */
.results-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
    box-sizing: border-box;
}

.result-row {
    margin-bottom: 2rem;
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 15px;
    border: 1px solid var(--glass-border);
    animation: fadeInDown 0.5s ease-out forwards;
    opacity: 0;
}

.result-row:nth-child(1) {
    animation-delay: 0.1s;
}

.result-row:nth-child(2) {
    animation-delay: 0.2s;
}

.result-row:nth-child(3) {
    animation-delay: 0.3s;
}

.result-row:nth-child(4) {
    animation-delay: 0.4s;
}

.result-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    align-items: center;
}

.result-candidate-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.result-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.result-name {
    font-weight: 700;
    font-size: 1.2rem;
}

.result-count {
    color: var(--text-muted);
}

.progress-bar-bg {
    background: rgba(255, 255, 255, 0.1);
    height: 12px;
    border-radius: 10px;
    width: 100%;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    background: linear-gradient(to right, #22c55e, #34d399);
    height: 100%;
    border-radius: 10px;
    transition: width 1s ease-out;
}

.result-percent {
    display: block;
    text-align: right;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* Success Modal Extras */
.modal-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}



.btn-confirm.full-width {
    width: 100%;
    display: block;
    box-sizing: border-box;
    text-align: center;
    text-decoration: none;
}

/* Mobile Vote View */
@media (max-width: 768px) {
    .candidate-grid {
        grid-template-columns: 1fr;
        padding: 1rem 1rem 8rem 1rem;
        gap: 1rem;
    }

    .card {
        display: flex;
        flex-direction: row;
        align-items: center;
        padding: 1rem;
        text-align: left;
    }

    .card-image-wrapper {
        padding: 0;
        margin-right: 1rem;
        width: auto;
        flex-shrink: 0;
    }

    .card-image {
        width: 70px;
        height: 70px;
        border-width: 2px;
    }

    .card-content {
        padding: 0;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .card-name {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }

    .vote-btn {
        margin-top: 0.25rem;
        padding: 0.5rem 1.25rem;
        font-size: 0.9rem;
    }

    /* Adjust hover effect for mobile to be less intrusive */
    .card:hover {
        transform: none;
    }

    h1 {
        font-size: 2rem;
        /* Reduced from 3rem */
        padding: 0 1rem;
        /* Ensure some side padding */
        word-wrap: break-word;
        /* Prevent overflow if single word is too long */
    }
}