/* ==========================================================================
   Visual Voting - Premium Frontend Styles
   ========================================================================== */

/* 1. The Outer Wrapper (Forces Full Screen Width) */
.wpiv-container {
    /* CSS Breakout Trick: Ignores theme constraints and forces full width */
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;

    background-color: #000000;
    /* Solid black background */
    padding-top: 80px;
    /* Generous top padding */
    padding-bottom: 80px;
    /* Generous bottom padding */

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #1e293b;
    box-sizing: border-box;
    overflow-x: hidden;
    /* Prevents accidental horizontal scrolling */
}

/* 2. The Inner Wrapper (Keeps the content perfectly centered) */
#wpiv-voting-form {
    max-width: 1200px;
    /* Keeps the images from getting too huge on large screens */
    margin: 0 auto;
    /* Centers the grid in the middle of the black background */
    padding: 0 20px;
    /* Adds side padding so it doesn't touch the screen edge on mobile */
}

/* --- 1. VOTER INFO FORM (Modern Card) --- */
.wpiv-voter-info {
    background: #ffffff;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    border: 1px solid #e2e8f0;
    margin-bottom: 35px;
    transition: all 0.3s ease;
}

.wpiv-voter-info label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #334155;
}

.wpiv-voter-info input[type="text"] {
    width: 100%;
    max-width: 500px;
    padding: 14px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    background: #f8fafc;
    color: #0f172a;
    transition: all 0.2s ease;
}

.wpiv-voter-info input[type="text"]:focus {
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    outline: none;
}

.wpiv-voter-info input[type="text"]::placeholder {
    color: #94a3b8;
}

/* --- 2. GRID LAYOUTS --- */
.wpiv-style-masonry {
    column-count: 3;
    column-gap: 24px;
}

.wpiv-style-masonry .wpiv-item {
    break-inside: avoid;
    margin-bottom: 24px;
    display: inline-block;
    width: 100%;
}

.wpiv-style-square,
.wpiv-style-landscape,
.wpiv-style-portrait {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 30px;
}

.wpiv-style-square img {
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.wpiv-style-landscape img {
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.wpiv-style-portrait img {
    aspect-ratio: 4 / 5;
    object-fit: cover;
}

@media (max-width: 900px) {
    .wpiv-style-masonry {
        column-count: 2;
    }

    .wpiv-style-square,
    .wpiv-style-landscape,
    .wpiv-style-portrait {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .wpiv-style-masonry {
        column-count: 1;
    }

    .wpiv-style-square,
    .wpiv-style-landscape,
    .wpiv-style-portrait {
        grid-template-columns: 1fr;
    }
}

/* --- 3. VOTING ITEMS & HOVER EFFECTS --- */
.wpiv-item {
    cursor: pointer;
    border-radius: 12px;
    position: relative;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 2px solid transparent;
    padding: 0;
}

.wpiv-image-wrapper {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
}

.wpiv-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s ease;
}

/* Hover State */
.wpiv-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px -8px rgba(255, 255, 255, 0.15);
    /* Adjusted shadow for black background */
}

.wpiv-item:hover img {
    transform: scale(1.03);
}

/* Selected State */
.wpiv-item.is-selected {
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2), 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    transform: translateY(-4px);
}

.wpiv-item input[type="checkbox"] {
    display: none;
}

/* Modern Checkmark for Selected Images */
.wpiv-item.is-selected .wpiv-image-wrapper::after {
    content: '✓';
    position: absolute;
    top: 12px;
    right: 12px;
    background: #3b82f6;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    z-index: 5;
    animation: wpivPop 0.2s ease-out forwards;
}

@keyframes wpivPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* --- 4. PREVIEW BUTTON (Lightbox) --- */
.wpiv-preview-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    color: white;
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10;
}

.wpiv-preview-btn:hover {
    background: rgba(59, 130, 246, 0.9);
    transform: translate(-50%, -50%) scale(1.05);
}

.wpiv-item:hover .wpiv-preview-btn {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* --- 5. VOTE COUNT BADGE --- */
.wpiv-results-hidden .wpiv-vote-count-badge {
    display: none;
}

.wpiv-vote-count-badge {
    text-align: center;
    background: #f8fafc;
    padding: 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    border-top: 1px solid #f1f5f9;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

.wpiv-item.is-selected .wpiv-vote-count-badge {
    background: #eff6ff;
    color: #1d4ed8;
    border-top-color: #bfdbfe;
}

.wpiv-vote-count-badge .count-number {
    font-size: 16px;
    font-weight: 700;
}

/* --- 6. SUBMIT BUTTON & ALERTS --- */
.wpiv-submit-btn {
    background: #000000;
    /* Solid black background */
    color: #22c55e;
    /* Vibrant green text */
    border: 2px solid #22c55e;
    /* Vibrant green outline */
    padding: 16px 32px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s ease;
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 200px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
}

.wpiv-submit-btn:hover {
    background: #22c55e;
    /* Inverts to solid green on hover for a premium feel */
    color: #000000;
    box-shadow: 0 10px 15px -3px rgba(34, 197, 94, 0.3);
    transform: translateY(-2px);
}

.wpiv-submit-btn:disabled {
    background: #1a1a1a;
    color: #4b5563;
    border-color: #374151;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.wpiv-already-voted-notice {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    font-weight: 600;
    display: flex;
    align-items: center;
}

#wpiv-feedback-message {
    margin-top: 20px;
    padding: 16px 20px;
    font-weight: 600;
    border-radius: 8px;
    display: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

#wpiv-feedback-message:not(:empty) {
    display: block;
}

#wpiv-feedback-message.success {
    color: #166534;
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
}

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

/* --- 7. LIGHTBOX MODAL --- */
.wpiv-lightbox {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.95);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.wpiv-lightbox-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.wpiv-lightbox-close {
    position: absolute;
    top: 25px;
    right: 40px;
    color: #cbd5e1;
    font-size: 45px;
    font-weight: 300;
    transition: 0.2s;
    cursor: pointer;
}

.wpiv-lightbox-close:hover {
    color: #ffffff;
    transform: scale(1.1);
}