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

/* 1. The Outer Wrapper (Forces Full Screen Width) */
.wpiv-container {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;

    background-color: #000000;
    background-image: 
        url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.08'/%3E%3C/svg%3E"),
        linear-gradient(to bottom, #000000 0%, #3b0764 50%, #000000 100%);
    padding-top: 100px;
    padding-bottom: 100px;

    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #f8fafc;
    box-sizing: border-box;
    overflow-x: hidden;
    min-height: 100vh;
}

@media (max-width: 768px) {
    .wpiv-container {
        padding-top: 60px;
        padding-bottom: 60px;
    }
}

/* 1a. Poll Header */
.wpiv-poll-header {
    max-width: 800px;
    margin: 0 auto 50px auto;
    text-align: center;
    padding: 0 24px;
}

.wpiv-poll-title {
    font-size: 42px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 24px;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.wpiv-poll-description {
    font-size: 18px;
    line-height: 1.7;
    color: #e2e8f0;
}

.wpiv-poll-description p {
    margin-bottom: 16px;
}
.wpiv-poll-description p:last-child {
    margin-bottom: 0;
}

/* 2. The Inner Wrapper */
#wpiv-voting-form {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 24px;
}

/* --- 1. VOTER INFO FORM (Glassmorphism Card) --- */
.wpiv-voter-info {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 32px;
    border-radius: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 50px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.wpiv-voter-info label {
    display: block;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #e2e8f0;
    letter-spacing: 0.5px;
}

.wpiv-voter-info input[type="text"] {
    width: 100%;
    padding: 18px 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: 16px;
    background: rgba(0, 0, 0, 0.2);
    color: #ffffff;
    transition: all 0.3s ease;
    font-family: 'Outfit', sans-serif;
}

.wpiv-voter-info input[type="text"]:focus {
    border-color: #6366f1;
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
    outline: none;
}

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

/* --- 2. GRID LAYOUTS --- */
.wpiv-grid {
    margin-top: 40px;
}

.wpiv-style-masonry {
    column-count: 3;
    column-gap: 30px;
}

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

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

.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: 1024px) {
    .wpiv-style-masonry { column-count: 2; }
    .wpiv-style-square, .wpiv-style-landscape, .wpiv-style-portrait { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .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: 20px;
    position: relative;
    background: transparent;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.wpiv-image-wrapper {
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    background: #0f172a;
    transition: all 0.4s ease;
}

.wpiv-image-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 40%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
}

.wpiv-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover State */
.wpiv-item:hover .wpiv-image-wrapper {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -10px rgba(99, 102, 241, 0.25);
}

.wpiv-item:hover .wpiv-image-wrapper::before {
    opacity: 1;
}

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

/* Selected State */
.wpiv-item.is-selected .wpiv-image-wrapper {
    border: 3px solid #818cf8;
    box-shadow: 0 0 0 6px rgba(129, 140, 248, 0.15), 0 25px 50px -12px rgba(99, 102, 241, 0.4);
    transform: translateY(-8px) scale(0.98);
}

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

/* Modern Checkmark for Selected Images */
.wpiv-item.is-selected .wpiv-image-wrapper::after {
    content: '✓';
    position: absolute;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #818cf8 0%, #4f46e5 100%);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 20px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    z-index: 5;
    animation: wpivPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes wpivPop {
    0% { transform: scale(0) rotate(-15deg); opacity: 0; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* --- 4. PREVIEW BUTTON (Lightbox) --- */
.wpiv-preview-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.wpiv-preview-btn svg {
    width: 28px;
    height: 28px;
    transition: transform 0.3s ease;
}

.wpiv-preview-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translate(-50%, -50%) scale(1.1);
}

.wpiv-preview-btn:hover svg {
    transform: scale(1.1);
}

.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 {
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    position: absolute;
}

.wpiv-results-visible .wpiv-vote-count-badge {
    opacity: 1;
    transform: translateY(0);
}

.wpiv-vote-count-badge {
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    margin-top: 16px;
    padding: 16px 0;
    font-size: 15px;
    font-weight: 500;
    color: #94a3b8;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.wpiv-item.is-selected .wpiv-vote-count-badge {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(79, 70, 229, 0.1) 100%);
    color: #a5b4fc;
    border-color: rgba(99, 102, 241, 0.2);
}

.wpiv-vote-count-badge .count-number {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    margin-right: 4px;
    display: inline-block;
}

.wpiv-item.is-selected .wpiv-vote-count-badge .count-number {
    color: #c7d2fe;
}

/* --- 6. SUBMIT BUTTON & ALERTS --- */
.wpiv-submit-btn {
    background: #4c1d95;
    color: #ffffff;
    border: none;
    outline: none;
    padding: 20px 48px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    border-radius: 100px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 40px auto 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 250px;
    box-shadow: 0 10px 25px -5px rgba(76, 29, 149, 0.4);
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.5px;
}

.wpiv-submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 35px -5px rgba(16, 185, 129, 0.4);
    background: #10b981;
    color: #ffffff;
    outline: none;
}

.wpiv-submit-btn:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: #64748b;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.wpiv-already-voted-notice {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #34d399;
    padding: 20px 24px;
    border-radius: 16px;
    margin-bottom: 40px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    font-size: 18px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

#wpiv-feedback-message {
    margin-top: 30px;
    padding: 20px 24px;
    font-weight: 500;
    border-radius: 16px;
    display: none;
    backdrop-filter: blur(8px);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    font-size: 16px;
}

#wpiv-feedback-message:not(:empty) {
    display: block;
    animation: wpivFadeIn 0.4s ease forwards;
}

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

#wpiv-feedback-message.success {
    color: #34d399;
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

#wpiv-feedback-message.error {
    color: #f87171;
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* --- 7. LIGHTBOX MODAL --- */
.wpiv-lightbox {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(2, 6, 23, 0.85);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.wpiv-lightbox-content {
    margin: auto;
    display: block;
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    transform: scale(0.95);
    opacity: 0;
    animation: wpivZoomIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes wpivZoomIn {
    to { transform: scale(1); opacity: 1; }
}

.wpiv-lightbox-close {
    position: absolute;
    top: 30px;
    right: 40px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 50px;
    font-weight: 300;
    line-height: 1;
    transition: all 0.3s ease;
    cursor: pointer;
    z-index: 2;
}

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