/**
 * ============================================
 * A2TINTAS TATTOO - INSTAGRAM EMBED MODAL STYLES
 * ============================================
 * 
 * Estilos para el popup modal con embed de Instagram
 * Modo oscuro forzado
 */

/* ============================================
   OVERLAY & MODAL BASE
   ============================================ */

:root {
    color-scheme: dark;
}

.instagram-modal-overlay {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 21000;
    /* Higher than navbar (20000) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    overscroll-behavior: contain;
}

.instagram-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.instagram-modal {
    max-width: 540px;
    max-height: 90vh;
    width: 100%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.8);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.instagram-modal-overlay.active .instagram-modal {
    transform: scale(1) translateY(0);
}

/* ============================================
   CLOSE BUTTON
   ============================================ */

.instagram-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    z-index: 10001;
}

.instagram-modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.instagram-modal-close svg {
    width: 24px;
    height: 24px;
}

/* ============================================
   INSTAGRAM EMBED CONTAINER
   ============================================ */

.instagram-embed-container {
    position: relative;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #000;
}

/* Forzar modo oscuro en el embed de Instagram */
.instagram-embed-container .instagram-media {
    background: #000 !important;
}

.instagram-embed-container iframe {
    background: #000 !important;
    border-radius: 12px;
}

/* ============================================
   LOADING STATE
   ============================================ */

.instagram-embed-loading {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #000;
    color: #888;
    gap: 1rem;
    z-index: 1;
}

.instagram-embed-loading p {
    font-size: 0.875rem;
    margin: 0;
}

.instagram-embed-loading .loading-bg {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.2;
    filter: blur(8px);
    z-index: 0;
}

.instagram-embed-loading .loading-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.instagram-modal-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #8c1c13;
    border-radius: 50%;
    animation: modal-spin 0.8s linear infinite;
}

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

/* Hide loading when iframe appears — JS adds .embed-loaded class as fallback */
.instagram-embed-container.embed-loaded .instagram-embed-loading {
    display: none;
}

@supports selector(:has(*)) {
    .instagram-embed-container:has(iframe) .instagram-embed-loading {
        display: none;
    }
}

/* ============================================
   IMAGE ONLY VIEW (sin Instagram)
   ============================================ */

.instagram-modal.image-only {
    max-width: 800px;
}

.instagram-modal-image-only {
    position: relative;
    display: flex;
    flex-direction: column;
}

.instagram-modal-image-only img {
    width: 100%;
    height: auto;
    max-height: 80vh;
    object-fit: contain;
    background: #000;
}

.instagram-modal-image-info {
    padding: 1rem 1.25rem;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.instagram-modal-artist {
    font-weight: 600;
    color: #fff;
}

.instagram-modal-style {
    padding: 0.25rem 0.75rem;
    background: rgba(140, 28, 19, 0.2);
    color: #8c1c13;
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 500;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 600px) {
    .instagram-modal-overlay {
        padding: 0;
    }

    .instagram-modal {
        border-radius: 12px;
        max-height: 85vh;
        max-width: 90%;
        margin-top: env(safe-area-inset-top, 20px);
    }

    .instagram-modal-close {
        top: 0.5rem;
        right: 0.5rem;
        background: rgba(0, 0, 0, 0.6);
    }
}

/* ============================================
   SCROLL CUSTOMIZATION
   ============================================ */

.instagram-embed-container::-webkit-scrollbar {
    width: 6px;
}

.instagram-embed-container::-webkit-scrollbar-track {
    background: transparent;
}

.instagram-embed-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.instagram-embed-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}