/**
 * Jersey Voting Frontend Styles
 *
 * Responsive grid layout with 3 columns on desktop
 * Mobile-first approach with breakpoints
 * Dual layout support: Classic and Modern
 *
 * @package MezszepsegVerseny
 * @since 1.1.0
 */

/* ==========================================================================
   Voting Wrapper
   ========================================================================== */

.msv-voting-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* ==========================================================================
   Jersey Grid Layout
   ========================================================================== */

.jersey-voting-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Tablet: 2 columns */
@media (min-width: 768px) {
    .jersey-voting-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop: 3 columns */
@media (min-width: 1024px) {
    .jersey-voting-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ==========================================================================
   Classic Layout Styles (v1.0 megtartása)
   ========================================================================== */

.msv-layout-classic .jersey-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.msv-layout-classic .jersey-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.msv-layout-classic .jersey-image-container {
    margin-bottom: 15px;
}

.msv-layout-classic .jersey-image {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.msv-layout-classic h3 {
    margin: 15px 0 10px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    text-align: center;
}

/* ==========================================================================
   Modern Layout - Zöld Geometrikus Dizájn (v1.1)
   ========================================================================== */

.msv-layout-modern .jersey-card {
    background: transparent;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.msv-layout-modern .jersey-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

/* Felső rész: Mez kép (2/3 magasság) */
.msv-layout-modern .jersey-card-image-section {
    position: relative;
    background: #ffffff;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1;
}

.msv-layout-modern .jersey-image-wrapper {
    position: relative;
    width: 100%;
    max-width: 250px;
    overflow: hidden;
    border-radius: 8px;
}

.msv-layout-modern .jersey-image {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.msv-layout-modern .jersey-image-wrapper:hover .jersey-image {
    transform: scale(1.05);
}

/* Alsó rész: Zöld geometrikus háttér + csapat név (1/3 magasság) */
.msv-layout-modern .jersey-card-info-section {
    position: relative;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px 25px;
    margin-top: -40px;
    overflow: hidden;
    z-index: 2;

    /* Angled transition */
    clip-path: polygon(0 25%, 100% 0, 100% 100%, 0 100%);

    /* Premium Green Mesh Background */
    background-color: #004d00;
    background-image:
        radial-gradient(at 0% 0%, hsla(110, 100%, 20%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(120, 100%, 15%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(130, 100%, 20%, 1) 0, transparent 50%),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.msv-layout-modern .jersey-team-name {
    margin: 0;
    color: #ffffff !important;
    font-size: 20px;
    font-weight: 800;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.5px;
    line-height: 1.2;
    text-transform: uppercase;
}

/* Szavazás gomb (kártya alatt) */
.msv-layout-modern .jersey-vote-button {
    width: calc(100% - 20px);
    margin: 10px;
    border-radius: 4px;
}

/* Zoom ikon (lightbox funkcióhoz) */
.jersey-image-wrapper {
    position: relative;
}

.image-zoom-icon {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.jersey-image-wrapper:hover .image-zoom-icon {
    opacity: 1;
}

/* Vote count elrejtése mindkét layoutban */
.vote-count {
    display: none !important;
}

/* ==========================================================================
   Vote Buttons
   ========================================================================== */

.jersey-vote-button {
    background: #d63638;
    color: white;
    border: none;
    padding: 12px 32px;
    cursor: pointer;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 700;
    transition: all 0.3s ease;
    width: 100%;
    margin: 1rem 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.jersey-vote-button:hover:not(:disabled) {
    background: #b02123;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.jersey-vote-button.selected {
    background: #008a20;
    box-shadow: 0 4px 10px rgba(0, 138, 32, 0.3);
}

.jersey-vote-button.selected:hover {
    background: linear-gradient(135deg, #007a20 0%, #005717 100%);
}

.jersey-vote-button:disabled,
.jersey-vote-button.disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ==========================================================================
   Submit Button Section
   ========================================================================== */

.submit-vote-section {
    text-align: center;
    margin: 2rem 0;
}

#submit-vote-button {
    position: sticky;
    bottom: 20px;
    display: inline-block;
    font-size: 20px;
    padding: 16px 48px;
    background: linear-gradient(135deg, #d63638 0%, #a02123 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(214, 54, 56, 0.4);
    transition: all 0.3s ease;
    z-index: 100;
}

#submit-vote-button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(214, 54, 56, 0.6);
}

#submit-vote-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* ==========================================================================
   Voting Closed Message
   ========================================================================== */

.voting-closed-message {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #d63638 0%, #b02a2c 100%);
    color: #ffffff;
    text-align: center;
    padding: 20px;
    font-size: 18px;
    font-weight: 700;
    z-index: 998;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.2);
    border-top: 3px solid #ffffff;
}

.voting-closed-message::before {
    content: "🔒 ";
    font-size: 20px;
    margin-right: 8px;
}

/* ==========================================================================
   Countdown Timer
   ========================================================================== */

#countdown-display {
    text-align: center;
    font-size: 20px;
    color: #d63638;
    margin: 2rem auto;
    padding: 1.5rem;
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    max-width: 600px;
}

#countdown-display p {
    margin: 0;
    line-height: 1.5;
}

#countdown-display strong {
    font-size: 28px;
    font-weight: bold;
    color: #d63638;
    display: inline-block;
    font-family: 'Courier New', monospace;
}

/* ==========================================================================
   Vote Messages
   ========================================================================== */

#vote-message {
    text-align: center;
    margin: 2rem auto;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    max-width: 600px;
    font-size: 16px;
}

#vote-message.success {
    background: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
}

#vote-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
}

#vote-message p {
    margin: 0;
}

/* ==========================================================================
   Vote Closed/Locked States
   ========================================================================== */

.vote-closed,
.vote-locked {
    color: #d63638;
    font-weight: 600;
    padding: 10px;
    background: #ffe5e5;
    border-radius: 4px;
    margin: 1rem 0;
    font-size: 14px;
}

/* ==========================================================================
   Lightbox Modal Styles
   ========================================================================== */

/* Lightbox modal */
.msv-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

.msv-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.msv-lightbox-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90%;
    max-height: 90%;
    z-index: 1000000;
}

.msv-lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    display: block;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.msv-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: transparent;
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    line-height: 1;
    transition: transform 0.2s ease;
}

.msv-lightbox-close:hover {
    transform: scale(1.2);
}

/* Prevent body scroll when lightbox is open */
body.msv-lightbox-open {
    overflow: hidden;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 767px) {
    .msv-voting-wrapper {
        padding: 1rem 0.5rem;
    }

    .jersey-voting-grid {
        gap: 1.5rem;
    }

    .msv-layout-modern .jersey-card-image-section {
        min-height: 220px;
        padding: 15px;
    }

    .msv-layout-modern .jersey-team-name {
        font-size: 16px;
    }

    .image-zoom-icon {
        opacity: 1;
        /* Mindig látható mobilon */
    }

    #submit-vote-button {
        font-size: 18px;
        padding: 14px 36px;
        width: 100%;
        max-width: 300px;
    }

    #countdown-display {
        font-size: 18px;
        padding: 1rem;
    }

    #countdown-display strong {
        font-size: 24px;
    }

    .msv-lightbox-content {
        max-width: 95%;
    }

    .msv-lightbox-close {
        top: 10px;
        right: 10px;
        background: rgba(0, 0, 0, 0.7);
        border-radius: 50%;
        font-size: 30px;
        width: 35px;
        height: 35px;
    }
}

/* Tablet reszponzivitás */
@media (min-width: 768px) and (max-width: 1023px) {
    .msv-layout-modern .jersey-card-image-section {
        min-height: 250px;
    }

    .msv-layout-modern .jersey-team-name {
        font-size: 17px;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.jersey-vote-button:focus,
#submit-vote-button:focus {
    outline: 3px solid #0073aa;
    outline-offset: 2px;
}

.jersey-card:focus-within {
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.2);
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.jersey-vote-button.loading,
#submit-vote-button.loading {
    position: relative;
    color: transparent;
}

.jersey-vote-button.loading::after,
#submit-vote-button.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

/* ==========================================================================
   Top 3 Leaderboard Section
   ========================================================================== */

.msv-leaderboard-section {
    margin-top: 4rem;
    padding: 3rem 2rem;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 15px;
    text-align: center;
}

.msv-leaderboard-section h2 {
    margin-bottom: 2rem;
    font-size: 28px;
    color: #ffffff;
    text-transform: uppercase;
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.msv-leaderboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 900px;
    margin: 0 auto;
}

.msv-leaderboard-item {
    background: #ffffff;
    border-radius: 12px;
    padding: 25px 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    border: 1px solid #eee;
}

.msv-leaderboard-rank {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: #d63638;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.msv-leaderboard-jersey-placeholder {
    width: 120px;
    height: 140px;
    margin: 0 auto 10px;
    background: #f0f0f0;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M20,30 L35,20 C42,28 58,28 65,20 L80,30 L85,55 L70,50 L70,90 L30,90 L30,50 L15,55 Z'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M20,30 L35,20 C42,28 58,28 65,20 L80,30 L85,55 L70,50 L70,90 L30,90 L30,50 L15,55 Z'/%3E%3C/svg%3E") no-repeat center;
    background-color: #c0c0c0;
}

.msv-leaderboard-percentage {
    font-size: 32px;
    font-weight: 900;
    color: #d63638;
    margin: 10px 0;
    display: block;
}

.msv-leaderboard-team {
    display: none;
}

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

    .msv-leaderboard-item {
        padding: 15px;
    }
}

@media print {

    .jersey-vote-button,
    #submit-vote-button,
    #countdown-display,
    .voting-closed-message,
    .msv-leaderboard-section {
        display: none;
    }

    .jersey-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}