/* =============================================
   Elementor Video Poll Grid — Frontend Styles
   ============================================= */

/* === Grid Layout === */
.evp-video-poll-grid {
    position: relative;
}

.evp-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* === Card === */
.evp-grid-item {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.evp-grid-item:hover {
    transform: translateY(-2px);
}

/* === Video Wrapper === */
.evp-video-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: #000;
    cursor: pointer;
    aspect-ratio: 9/16;
}

.evp-video-wrapper video,
.evp-video-wrapper iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    border: none;
    background-color: #000;
    background-size: cover;
    background-position: center;
}

.evp-video-wrapper video {
    background-repeat: no-repeat;
}

.evp-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s ease;
}

.evp-video-wrapper.evp-playing .evp-video-overlay {
    opacity: 0;
    pointer-events: none;
}

.evp-video-wrapper:hover .evp-video-overlay {
    opacity: 1;
    pointer-events: auto;
}

.evp-play-icon {
    color: #ffffff;
    line-height: 1;
    transition: transform 0.2s ease;
}

.evp-play-icon svg {
    width: 48px;
    height: 48px;
    display: block;
}

.evp-video-overlay:hover .evp-play-icon {
    transform: scale(1.1);
}

.evp-no-video {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9ca3af;
    font-size: 14px;
}

/* === Instagram Reels embed (official embed.js) === */
.evp-instagram-wrap {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

/* Override Instagram embed.js fixed sizing – force fill the wrapper */
.evp-instagram-wrap iframe {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.evp-instagram-wrap .instagram-media {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    min-width: 0 !important;
    width: 100% !important;
}

/* === TikTok JS-injected iframe container === */
.evp-tiktok-wrap {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.evp-tiktok-wrap iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* === Title === */
.evp-item-title {
    margin: 10px 12px 5px;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    text-align: center;
    line-height: 1.3;
}

/* === Vote Area === */
.evp-vote-area {
    padding: 8px 12px;
    text-align: center;
}

.evp-vote-btn {
    display: inline-block;
    width: 100%;
    padding: 10px 20px;
    margin: 4px 0;
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    background-color: #6366f1;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.4;
    text-align: center;
    box-sizing: border-box;
}

.evp-vote-btn:hover {
    background-color: #4f46e5;
    transform: translateY(-1px);
}

.evp-vote-btn:active {
    transform: translateY(0);
}

.evp-vote-btn.evp-voted {
    background-color: #22c55e;
    cursor: default;
    pointer-events: none;
}

.evp-vote-btn.evp-voted::before {
    content: '\2713\0020';
}

/* === Vote Count === */
.evp-vote-count {
    font-size: 13px;
    color: #6b7280;
    text-align: center;
    margin: 4px 0;
}

.evp-count-number {
    font-weight: 700;
}

/* =============================================
   Popover — appended to <body> by JS
   Inline styles on the element handle display/position
   so caching plugins cannot interfere.
   ============================================= */
.evp-popover {
    width: 280px;
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
    box-sizing: border-box;
}

/* Arrow pointing DOWN toward the button */
.evp-popover::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 12px;
    height: 12px;
    background: #ffffff;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.06);
}

/* Close button */
.evp-popover .evp-popup-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    font-size: 22px;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.evp-popover .evp-popup-close:hover {
    color: #1a1a1a;
}

/* Heading / text */
.evp-popup-heading {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    text-align: center;
}

.evp-popup-text {
    margin: 0 0 14px;
    font-size: 13px;
    color: #6b7280;
    text-align: center;
}

/* Form */
.evp-vote-form {
    position: relative;
}

.evp-email-input {
    display: block;
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    color: #1a1a1a;
    background: #f9fafb;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    margin-bottom: 12px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.evp-email-input:focus {
    border-color: #6366f1;
    outline: none;
    background: #ffffff;
}

.evp-email-input.evp-input-error {
    border-color: #ef4444;
}

.evp-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    background-color: #6366f1;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    box-sizing: border-box;
    gap: 8px;
}

.evp-submit-btn:hover {
    background-color: #4f46e5;
}

.evp-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Terms checkbox */
.evp-terms-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.4;
    color: #6b7280;
}

.evp-terms-checkbox {
    margin-top: 2px;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.evp-terms-label {
    flex: 1;
}

.evp-terms-link {
    color: #6366f1;
    text-decoration: underline;
}

.evp-terms-link:hover {
    color: #4f46e5;
}

/* Messages */
.evp-message {
    margin-top: 16px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    font-weight: 500;
}

.evp-message-success {
    color: #22c55e;
    background: #f0fdf4;
}

.evp-message-error {
    color: #ef4444;
    background: #fef2f2;
}

/* No videos placeholder */
.evp-no-videos {
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
    font-size: 16px;
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 1024px) {
    .evp-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .evp-grid {
        grid-template-columns: 1fr;
    }

    .evp-popover {
        width: 260px;
        padding: 16px;
    }
}
