/**
 * SNELLYX Modal System CSS
 * 
 * Sistema unificato di modali per tutta l'applicazione
 * Supporta modali fullscreen e auto-size
 * Integrato con theme.json per consistenza colori
 * 
 * @author SNELLYX Team
 * @version 1.0.0
 * @date 2025-11-21
 */

/* ===== OVERLAY ===== */
.snellyx-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    backdrop-filter: blur(5px);
    animation: modal-fade-in 0.3s ease-out;
}

.snellyx-modal-overlay.active {
    display: flex;
}

/* ===== MODAL CONTAINER ===== */
.snellyx-modal {
    position: relative;
    display: flex;
    flex-direction: column;
    animation: modal-slide-in 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Fullscreen Modal */
.snellyx-modal.fullscreen {
    width: calc(100vw - 40px);
    height: calc(100dvh - 40px);
    max-width: 1200px;
    max-height: 900px;
}

/* Auto-size Modal */
.snellyx-modal.autosize {
    min-width: 300px;
    max-width: 420px;
    min-height: 200px;
    max-height: 90dvh;
    width: 95vw;
    height: auto;
}

@media (min-width: 480px) {
    .snellyx-modal.autosize {
        width: auto;
    }
}

/* ===== MODAL HEADER ===== */
.snellyx-modal-header {
    flex-shrink: 0;
    padding: 0 0 20px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.snellyx-modal-title {
    font-family: 'Oswald', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ===== MODAL CONTENT ===== */
.snellyx-modal-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

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

.snellyx-modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.snellyx-modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

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

/* Padding per fullscreen */
.snellyx-modal.fullscreen .snellyx-modal-content {
    padding: 40px;
}

/* Padding per autosize */
.snellyx-modal.autosize .snellyx-modal-content {
    padding: 30px;
}

/* ===== MODAL FOOTER ===== */
.snellyx-modal-footer {
    flex-shrink: 0;
    padding: 20px 0 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* ===== CLOSE BUTTON ===== */
.snellyx-modal-close {
    position: absolute;
    top: -22px;
    right: -22px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: all 0.3s ease;
    padding: 0;
}

.snellyx-modal-close img {
    width: 18px;
    height: 18px;
    filter: brightness(0) invert(1);
    transition: transform 0.3s ease;
}

.snellyx-modal-close:hover {
    transform: scale(1.1);
}

.snellyx-modal-close:hover img {
    transform: rotate(90deg);
}

.snellyx-modal-close:active {
    transform: scale(0.95);
}

/* ===== ANIMAZIONI ===== */
@keyframes modal-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modal-slide-in {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes modal-fade-out {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes modal-slide-out {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
}

/* Animazioni di chiusura */
.snellyx-modal-overlay.closing {
    animation: modal-fade-out 0.3s ease-out forwards;
}

.snellyx-modal-overlay.closing .snellyx-modal {
    animation: modal-slide-out 0.3s ease-out forwards;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .snellyx-modal.fullscreen {
        width: calc(100vw - 20px);
        height: calc(100dvh - 20px);
    }
    
    .snellyx-modal.autosize {
        max-width: calc(100vw - 20px);
        min-width: calc(100vw - 40px);
    }
    
    .snellyx-modal.fullscreen .snellyx-modal-content {
        padding: 20px;
    }
    
    .snellyx-modal.autosize .snellyx-modal-content {
        padding: 20px;
    }
    
    .snellyx-modal-title {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .snellyx-modal-close {
        top: -18px;
        right: -18px;
        width: 36px;
        height: 36px;
    }
    
    .snellyx-modal-close img {
        width: 14px;
        height: 14px;
    }
    
    .snellyx-modal-title {
        font-size: 20px;
    }
}

/* ===== UTILITY CLASSES ===== */
.snellyx-modal-body-no-scroll {
    overflow: hidden;
}

/* Testo modale */
.snellyx-modal-text {
    color: rgba(255, 255, 255, 0.9);
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    line-height: 1.6;
}

.snellyx-modal-text p {
    margin: 0 0 15px 0;
}

.snellyx-modal-text p:last-child {
    margin-bottom: 0;
}

/* Lista modale */
.snellyx-modal-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.snellyx-modal-list li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.snellyx-modal-list li:last-child {
    border-bottom: none;
}
