/* Product Modal System - Floating Windows for Games */

/* Modal Overlay */
.product-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    /* Fallback for browsers that don't support backdrop-filter */
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 10005; /* Higher than other modals */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease-out, visibility 0.3s ease-out;
}

/* Modal visible state */
.product-modal-overlay.visible {
    visibility: visible;
    opacity: 1;
}

/* Fallback for browsers without backdrop-filter support */
@supports not (backdrop-filter: blur(8px)) {
    .product-modal-overlay {
        background: rgba(0, 0, 0, 0.92) !important;
    }
}

/* Animation keyframes removed - using CSS transitions instead */

/* Main Modal Window */
.product-modal {
    background: linear-gradient(135deg, 
        rgba(20, 25, 35, 0.95) 0%, 
        rgba(30, 35, 45, 0.95) 50%, 
        rgba(25, 30, 40, 0.95) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    width: 90vw;
    height: 85vh;
    max-width: 1200px;
    max-height: 800px;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    animation: modalScaleIn 0.3s ease-out forwards;
    overflow: hidden;
}

@keyframes modalScaleIn {
    from {
        transform: scale(0.9);
    }
    to {
        transform: scale(1);
    }
}

/* Modal Header */
.product-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, 
        rgba(40, 45, 55, 0.8) 0%, 
        rgba(30, 35, 45, 0.8) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.product-modal-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.product-icon {
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.product-modal-title h2 {
    color: var(--ecosystem-light, #ffffff);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.product-modal-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}


.product-close-btn {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.5rem;
    font-weight: bold;
}

.product-close-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Modal Content */
.product-modal-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    position: relative;
}

/* Custom Scrollbar */
.product-modal-content::-webkit-scrollbar {
    width: 8px;
}

.product-modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.product-modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    transition: background 0.3s ease;
}

.product-modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Loading State */
.product-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--ecosystem-light, #ffffff);
    text-align: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top: 3px solid var(--ecosystem-primary, #8b5cf6);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.product-loading p {
    font-size: 1.1rem;
    margin: 0;
    opacity: 0.8;
}

/* Error State */
.product-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--ecosystem-light, #ffffff);
    text-align: center;
    padding: 2rem;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.product-error h3 {
    color: #ef4444;
    font-size: 1.5rem;
    margin: 0 0 1rem 0;
}

.product-error p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    margin: 0 0 2rem 0;
    max-width: 400px;
}

.error-retry-btn,
.error-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--ecosystem-light, #ffffff);
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0.5rem;
    font-size: 1rem;
}

.error-retry-btn:hover,
.error-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* Modal Footer */
.product-modal-footer {
    padding: 1rem 2rem;
    background: rgba(20, 25, 35, 0.8);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
}

/* Navigation Dots */
.product-navigation-dots {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-dot:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(1.2);
}

.nav-dot.active {
    background: var(--ecosystem-primary, #8b5cf6);
    transform: scale(1.3);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

/* Prevent body scroll when modal is open */
body.modal-open {
    overflow: hidden;
    height: 100vh; /* Prevent scroll on mobile */
}

/* Responsive Design */
@media (max-width: 768px) {
    .product-modal-overlay {
        padding: 1rem;
    }
    
    .product-modal {
        width: 95vw;
        height: 90vh;
        border-radius: 15px;
    }
    
    .product-modal-header {
        padding: 1rem 1.5rem;
    }
    
    .product-modal-title h2 {
        font-size: 1.25rem;
    }
    
    .product-icon {
        font-size: 1.5rem;
    }
    
    .product-close-btn {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .product-close-btn {
        font-size: 1.25rem;
    }
    
    .product-modal-footer {
        padding: 0.75rem 1.5rem;
    }
}

@media (max-width: 480px) {
    .product-modal-overlay {
        padding: 0.5rem;
    }
    
    .product-modal {
        width: 98vw;
        height: 95vh;
        border-radius: 10px;
    }
    
    .product-modal-header {
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }
    
    .product-modal-title {
        gap: 0.75rem;
    }
    
    .product-modal-title h2 {
        font-size: 1.1rem;
    }
    
    .product-icon {
        font-size: 1.25rem;
    }
    
    .product-modal-actions {
        gap: 0.25rem;
    }
    
    .product-close-btn {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
    
    .product-close-btn {
        font-size: 1.1rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .product-modal {
        border: 2px solid #ffffff;
    }
    
    .product-modal-header {
        border-bottom: 2px solid #ffffff;
    }
    
    .product-close-btn {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .product-modal-overlay,
    .product-modal {
        animation: none;
    }
    
    .product-close-btn:hover,
    .error-retry-btn:hover,
    .error-close-btn:hover {
        transform: none;
    }
    
    .loading-spinner {
        animation: none;
        border-top-color: var(--ecosystem-primary, #8b5cf6);
    }
}