/* =========================================
   Premium Voting Section Styles
   ========================================= */

/* --- 1. Highest Voted Card --- */
.highest-voted-purpose-card {
    position: relative;
    padding: 8px;
    /* Slightly more padding for the border effect */
    background: linear-gradient(135deg, #e0e7ff 0%, #f3e8ff 100%);
    /* Softer gradient */
    border-radius: var(--cb-radius-lg, 24px);
    box-shadow:
        0 10px 25px -5px rgba(99, 102, 241, 0.15),
        0 8px 10px -6px rgba(99, 102, 241, 0.1);
    margin: 0 auto 40px;
    max-width: 550px;
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.card-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 140px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    font-size: 2rem;
    font-weight: 800;
    color: var(--cb-color-primary-dark, #4f46e5);
    text-align: center;
    padding: 30px;
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.5);
    /* Gradient Text */
    background: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

/* --- 2. Purpose List Cards --- */
.purpose-list-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 20px;
    justify-content: center;
    margin-bottom: 50px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.purpose-item-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 15px;
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid var(--cb-border-light, #f1f5f9);
    box-shadow: var(--cb-shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    cursor: default;
}

.purpose-item-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.1);
    border-color: var(--cb-color-primary-light, #818cf8);
}

/* Flash Animation for Updates */
@keyframes flashUpdate {
    0% {
        background-color: #ffffff;
        transform: scale(1);
    }

    50% {
        background-color: #f0fdf4;
        transform: scale(1.05);
        border-color: #22c55e;
    }

    /* Green flash */
    100% {
        background-color: #ffffff;
        transform: scale(1);
    }
}

.purpose-item-card.updated-flash {
    animation: flashUpdate 0.6s ease-out;
}

/* Decorative Top Bar */
.purpose-item-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #6366f1, #ec4899);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.purpose-item-card:hover::after {
    opacity: 1;
}

.purpose-item-card p.tip {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--cb-text-main, #1e293b);
    margin: 0 0 6px 0;
    line-height: 1.3;
}

.purpose-item-card p.vote-count-second-text {
    font-size: 0.9rem;
    color: var(--cb-text-cloud, #64748b);
    font-weight: 500;
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 20px;
    transition: all 0.2s ease;
}

.purpose-item-card:hover p.vote-count-second-text {
    background: #eef2ff;
    color: var(--cb-color-primary);
}

/* --- 3. Voting Form Premium --- */
.voting-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 36px 40px;
    background: #ffffff;
    border-radius: 24px;
    /* More rounded */
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.08);
    /* Deeper shadow */
    border: 1px solid var(--cb-border-medium, #e2e8f0);
    max-width: 480px;
    margin: 0 auto;
    position: relative;
    isolation: isolate;
}

/* Subtle background pattern/gradient behind form */
.voting-form::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.03), transparent 70%);
    z-index: -1;
    border-radius: 24px;
}

.voting-form label {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--cb-text-main);
    margin-bottom: 0;
    letter-spacing: -0.01em;
}

/* Premium Select */
.voting-form select {
    width: 100%;
    padding: 16px 20px;
    font-size: 1.05rem;
    color: var(--cb-text-main);
    background-color: #fff;
    border: 2px solid var(--cb-border-medium, #e2e8f0);
    border-radius: 14px;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    background-size: 20px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    font-weight: 500;
}

.voting-form select:hover {
    border-color: var(--cb-color-primary-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.voting-form select:focus {
    border-color: var(--cb-color-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.voting-form select:disabled {
    background-color: #f8fafc;
    color: #94a3b8;
    border-color: #e2e8f0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    background-image: none;
}

/* Premium Button */
.voting-form button {
    width: 100%;
    padding: 18px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 8px 20px -4px rgba(79, 70, 229, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin-top: 10px;
}

/* Shine effect */
.voting-form button::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: skewX(-20deg);
    transition: 0.5s;
}

.voting-form button:hover::after {
    left: 100%;
    transition: 0.5s;
}

.voting-form button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px -5px rgba(79, 70, 229, 0.5);
    background: linear-gradient(135deg, #595cdb 0%, #4338ca 100%);
}

.voting-form button:active:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px -3px rgba(79, 70, 229, 0.4);
}

.voting-form button:disabled {
    background: #cbd5e1;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
    color: #94a3b8;
}

/* --- 4. Success Message --- */
.vote-message {
    margin-top: 24px;
    padding: 18px 24px;
    color: #166534;
    /* Green 800 */
    background: #f0fdf4;
    /* Green 50 */
    border: 1px solid #bbf7d0;
    /* Green 200 */
    border-radius: 16px;
    font-weight: 600;
    text-align: center;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    animation: slideUpFade 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Bouncy enter */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.vote-message::before {
    content: '✓';
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 20px;
    height: 20px;
    background: #22c55e;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 800;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

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

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .card-inner {
        font-size: 1.5rem;
        min-height: 100px;
        padding: 20px;
    }

    .purpose-list-cards {
        grid-template-columns: repeat(2, 1fr);
        /* 2 per row on mobile */
        gap: 12px;
    }

    .purpose-item-card {
        width: 100%;
        padding: 16px 10px;
    }

    .voting-form {
        padding: 24px;
        margin: 0 16px;
        width: auto;
    }
}

@media (max-width: 480px) {
    .purpose-list-cards {
        grid-template-columns: 1fr;
        /* Stack on very small screens */
    }

    .card-inner {
        font-size: 1.25rem;
    }
}