/* BIC Voting - Clean & Simple Design */

.bic-voting-container {
    max-width: 640px;
    margin: 32px auto;
    padding: 0 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: #1f2937;
}

/* Header / counter */
.bic-voting-header {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 20px 24px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    position: sticky;
    top: 12px;
    z-index: 5;
}

.bic-voting-counter {
    font-size: 16px;
    font-weight: 500;
    color: #374151;
    letter-spacing: 0.1px;
}

.bic-voting-count {
    display: inline-block;
    min-width: 26px;
    padding: 2px 10px;
    margin: 0 4px;
    background: #eff6ff;
    color: #1d4ed8;
    border-radius: 999px;
    font-weight: 700;
    font-size: 15px;
    transition: all 0.2s ease;
}

.bic-voting-count.is-complete {
    background: #dcfce7;
    color: #15803d;
}

/* Hint line under counter */
.bic-voting-hint {
    font-size: 13px;
    color: #6b7280;
    margin-top: 6px;
    font-weight: 400;
}

/* Success / status message when 4 selected */
.bic-voting-status {
    margin-top: 12px;
    padding: 10px 14px;
    background: #ecfdf5;
    color: #065f46;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
}

/* Already voted card */
.bic-voting-already {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 14px;
    padding: 28px 20px;
    text-align: center;
    margin: 24px 0;
}

/* List */
.bic-voting-form {
    margin: 0;
}

.bic-voting-list {
    display: grid;
    gap: 10px;
    margin-bottom: 24px;
}

/* Candidate row */
.bic-voting-item {
    background: #ffffff;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    transition: all 0.18s ease;
    overflow: hidden;
}

.bic-voting-item:hover {
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(15,23,42,0.06);
}

.bic-voting-label {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    cursor: pointer;
    user-select: none;
    margin: 0;
    width: 100%;
}

/* Custom checkbox */
.bic-voting-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    min-width: 24px;
    border: 2px solid #cbd5e1;
    border-radius: 7px;
    background: #ffffff;
    cursor: pointer;
    position: relative;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.bic-voting-checkbox:hover {
    border-color: #94a3b8;
}

.bic-voting-checkbox:checked {
    background: #2563eb;
    border-color: #2563eb;
}

.bic-voting-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 3px;
    width: 6px;
    height: 11px;
    border: solid #ffffff;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

.bic-voting-checkbox:disabled {
    background: #f1f5f9;
    border-color: #e2e8f0;
    cursor: not-allowed;
}

.bic-voting-checkbox:disabled + .bic-voting-name {
    color: #9ca3af;
}

/* Selected state on the whole row */
.bic-voting-item:has(.bic-voting-checkbox:checked) {
    background: #eff6ff;
    border-color: #2563eb;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}

/* Candidate name */
.bic-voting-name {
    font-size: 16px;
    font-weight: 500;
    color: #111827;
    line-height: 1.4;
    flex: 1;
}

/* Submit button */
.bic-voting-submit {
    display: block;
    width: 100%;
    padding: 16px 20px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28);
    margin-top: 8px;
}

.bic-voting-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
}

.bic-voting-submit:active:not(:disabled) {
    transform: translateY(0);
}

.bic-voting-submit:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
}

/* Revote / change button */
.bic-voting-revote {
    display: block;
    margin: 14px auto 0;
    padding: 10px 18px;
    background: transparent;
    color: #6b7280;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.bic-voting-revote:hover {
    background: #f9fafb;
    color: #374151;
    border-color: #d1d5db;
}

/* Messages */
.bic-voting-message {
    padding: 12px 16px;
    border-radius: 10px;
    margin: 16px 0;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

.bic-voting-message.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.bic-voting-message.success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

/* Pulse animation for full selection */
@keyframes bicPulse {
    0%, 100% { box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28); }
    50% { box-shadow: 0 4px 22px rgba(37, 99, 235, 0.5); }
}

.bic-voting-submit:not(:disabled) {
    animation: bicPulse 2.4s ease-in-out infinite;
}

/* Mobile tweaks */
@media (max-width: 520px) {
    .bic-voting-container {
        margin: 16px auto;
        padding: 0 12px;
    }
    .bic-voting-header {
        padding: 16px;
        border-radius: 12px;
    }
    .bic-voting-counter {
        font-size: 15px;
    }
    .bic-voting-label {
        padding: 14px 14px;
        gap: 12px;
    }
    .bic-voting-name {
        font-size: 15px;
    }
    .bic-voting-submit {
        padding: 15px 18px;
        font-size: 15px;
    }
}


/* ---- Voting page title ---- */
.bic-voting-title {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
    text-align: center;
    margin: 0 0 18px;
    letter-spacing: -0.3px;
    line-height: 1.25;
}

@media (max-width: 520px) {
    .bic-voting-title {
        font-size: 22px;
        margin-bottom: 14px;
    }
}

/* ---- Floating action bar when 4 selected ---- */
/* When the container has bic-four-selected class the JS will already show the submit + revote buttons.
   We promote them to a centered floating bar at the bottom of the viewport. */
.bic-four-selected .bic-voting-submit,
.bic-four-selected .bic-voting-revote {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    max-width: 360px;
    width: calc(100% - 32px);
    margin: 0;
    animation: bicFloatIn 0.35s ease-out both;
}

.bic-four-selected .bic-voting-submit {
    bottom: 76px;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.35);
}

.bic-four-selected .bic-voting-revote {
    bottom: 22px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

/* Combine the pulse and float-in: override pulse to keep the centered transform */
@keyframes bicPulseFloat {
    0%, 100% {
        box-shadow: 0 10px 30px rgba(37, 99, 235, 0.35);
    }
    50% {
        box-shadow: 0 12px 38px rgba(37, 99, 235, 0.55);
    }
}

.bic-four-selected .bic-voting-submit:not(:disabled) {
    animation: bicFloatIn 0.35s ease-out, bicPulseFloat 2.4s ease-in-out 0.35s infinite;
}

@keyframes bicFloatIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Add bottom padding to the list so floating bar doesn't cover the last candidate */
.bic-four-selected .bic-voting-list {
    padding-bottom: 140px;
}

/* On wider screens the floating bar can be a touch wider */
@media (min-width: 600px) {
    .bic-four-selected .bic-voting-submit,
    .bic-four-selected .bic-voting-revote {
        max-width: 420px;
    }
}


/* Soft gradient backdrop tray behind floating buttons */
.bic-four-selected::before {
    content: '';
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 180px;
    background: linear-gradient(to top, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.85) 40%, rgba(255,255,255,0) 100%);
    pointer-events: none;
    z-index: 99;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

/* Smaller width on the change button so it feels secondary */
.bic-four-selected .bic-voting-revote {
    max-width: 280px !important;
    width: auto;
    padding: 8px 16px;
    font-size: 13px;
}


/* =============================================
   RESULTS PAGE
   ============================================= */

.bic-results-container {
    max-width: 720px;
    margin: 32px auto;
    padding: 0 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: #1f2937;
}

/* Header card */
.bic-results-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: #ffffff;
    border-radius: 16px;
    padding: 28px 24px;
    text-align: center;
    margin-bottom: 24px;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.18);
}

.bic-results-title {
    margin: 0 0 18px;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: #ffffff;
    line-height: 1.2;
}

/* Stats row */
.bic-results-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 6px;
}

.bic-results-stat {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    padding: 14px 10px;
    backdrop-filter: blur(4px);
}

.bic-results-stat-num {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    color: #ffffff;
    margin-bottom: 4px;
}

.bic-results-stat-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* Empty state */
.bic-results-empty {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    padding: 40px 24px;
    text-align: center;
}

.bic-results-empty-icon {
    font-size: 48px;
    line-height: 1;
    margin-bottom: 12px;
}

.bic-results-empty-text {
    font-size: 18px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.bic-results-empty-sub {
    font-size: 14px;
    color: #64748b;
}

/* Reveal button area */
.bic-results-reveal-wrap {
    text-align: center;
    margin: 28px 0 20px;
}

.bic-results-reveal-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    border: none;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
    animation: bicResultsPulse 2.4s ease-in-out infinite;
}

.bic-results-reveal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 26px rgba(37, 99, 235, 0.45);
}

.bic-results-reveal-icon {
    font-size: 18px;
    line-height: 1;
}

.bic-results-reveal-hint {
    margin-top: 10px;
    font-size: 13px;
    color: #64748b;
}

@keyframes bicResultsPulse {
    0%, 100% { box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35); }
    50% { box-shadow: 0 6px 28px rgba(37, 99, 235, 0.55); }
}

/* Hidden reveal target before user clicks */
.bic-results-reveal-target {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.4s ease, max-height 0.6s ease;
}

.bic-results-reveal-target.is-revealed {
    opacity: 1;
    max-height: 5000px;
}

/* Hide reveal button after click */
.bic-results-reveal-wrap.is-hidden {
    opacity: 0;
    max-height: 0;
    margin: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, max-height 0.4s ease, margin 0.3s ease;
}

/* Results list */
.bic-results-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

.bic-results-item {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px 16px;
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 14px;
    align-items: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    opacity: 0;
    transform: translateY(12px);
}

.bic-results-reveal-target.is-revealed .bic-results-item {
    animation: bicItemIn 0.5s ease-out forwards;
}

@keyframes bicItemIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.bic-results-item:hover {
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

/* Rank circle */
.bic-results-rank {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #475569;
    font-weight: 700;
}

.bic-results-rank-num {
    font-size: 16px;
}

/* Top rank styles */
.bic-results-item.rank-1 .bic-results-rank {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.35);
}

.bic-results-item.rank-2 .bic-results-rank {
    background: linear-gradient(135deg, #cbd5e1, #94a3b8);
    color: #ffffff;
}

.bic-results-item.rank-3 .bic-results-rank {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #ffffff;
}

.bic-results-item.rank-top {
    border-color: #86efac;
    background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);
}

.bic-results-item.rank-top:not(.rank-1):not(.rank-2):not(.rank-3) .bic-results-rank {
    background: #dcfce7;
    color: #166534;
}

/* Body / name / count */
.bic-results-body {
    min-width: 0;
}

.bic-results-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.bic-results-name {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
}

.bic-results-count {
    font-size: 14px;
    color: #475569;
    white-space: nowrap;
}

.bic-results-count strong {
    color: #0f172a;
    font-size: 16px;
    font-weight: 700;
}

.bic-results-count-label {
    color: #64748b;
    margin-left: 3px;
}

/* Bar */
.bic-results-bar-track {
    height: 8px;
    background: #f1f5f9;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.bic-results-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #60a5fa, #2563eb);
    border-radius: 999px;
    width: 0;
    transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.bic-results-item.rank-1 .bic-results-bar-fill {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.bic-results-item.rank-2 .bic-results-bar-fill {
    background: linear-gradient(90deg, #cbd5e1, #94a3b8);
}

.bic-results-item.rank-3 .bic-results-bar-fill {
    background: linear-gradient(90deg, #f59e0b, #b45309);
}

.bic-results-item.rank-top:not(.rank-1):not(.rank-2):not(.rank-3) .bic-results-bar-fill {
    background: linear-gradient(90deg, #4ade80, #16a34a);
}

/* Keep bar empty until revealed */
.bic-results-reveal-target:not(.is-revealed) .bic-results-bar-fill {
    width: 0 !important;
}

/* Footer */
.bic-results-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 13px;
    color: #64748b;
}

.bic-results-legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4ade80;
    margin: 0 4px -1px 0;
}

.bic-results-share {
    margin-top: 4px;
    font-size: 12px;
    color: #94a3b8;
}

/* Mobile tweaks */
@media (max-width: 520px) {
    .bic-results-container {
        margin: 16px auto;
        padding: 0 12px;
    }
    .bic-results-header {
        padding: 22px 16px;
        border-radius: 14px;
    }
    .bic-results-title {
        font-size: 22px;
    }
    .bic-results-stat-num {
        font-size: 22px;
    }
    .bic-results-stat-label {
        font-size: 11px;
    }
    .bic-results-item {
        grid-template-columns: 40px 1fr;
        gap: 10px;
        padding: 12px;
    }
    .bic-results-rank {
        width: 36px;
        height: 36px;
    }
    .bic-results-rank-num {
        font-size: 14px;
    }
    .bic-results-name {
        font-size: 14px;
    }
    .bic-results-count {
        font-size: 13px;
    }
    .bic-results-count strong {
        font-size: 14px;
    }
}
