/* mivp-frontend.css */
body.mivp-open {
    overflow: hidden !important;
}

#mivp-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    touch-action: none; /* Previne scroll no body e double tap to zoom padrão */
}

#mivp-overlay.mivp-active {
    opacity: 1;
    visibility: visible;
}

.mivp-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.mivp-image-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.mivp-image-wrapper img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    transition: transform 0.1s ease-out;
    transform-origin: center center;
    cursor: grab;
}

.mivp-image-wrapper img:active {
    cursor: grabbing;
}

/* UI Elements */
.mivp-top-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    z-index: 10;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 100%);
    pointer-events: none;
}

.mivp-top-bar > * {
    pointer-events: auto;
}

.mivp-counter {
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.mivp-actions {
    display: flex;
    gap: 10px;
}

.mivp-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s, transform 0.2s;
    outline: none;
    border-radius: 50%;
}

.mivp-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.mivp-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.8));
}

.mivp-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.2);
    border: none;
    color: #fff;
    padding: 15px;
    cursor: pointer;
    z-index: 10;
    border-radius: 50%;
    margin: 0 15px;
    transition: background 0.3s, transform 0.2s;
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mivp-nav:hover {
    background: rgba(0,0,0,0.6);
    transform: translateY(-50%) scale(1.1);
}

.mivp-nav-prev {
    left: 0;
}

.mivp-nav-next {
    right: 0;
}

.mivp-nav svg {
    width: 30px;
    height: 30px;
    fill: currentColor;
}

.mivp-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 30px 20px 20px;
    box-sizing: border-box;
    color: #fff;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
    z-index: 10;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    pointer-events: none;
}

.mivp-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: mivp-spin 1s linear infinite;
    z-index: 1;
}

@keyframes mivp-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@media (max-width: 768px) {
    .mivp-nav {
        display: none; /* Mobile usa swipe */
    }
    .mivp-btn svg {
        width: 28px;
        height: 28px;
    }
}
