/**
 * Universal Modal CSS
 * Eternal Illusion - Univerzális modal ablak stílusok
 * 2025. október 26.
 */

/* ===== MODAL BASE ===== */

.universal-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.universal-modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.modal-container {
    position: relative;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateZ(0); /* GPU acceleration a smooth animation-hez */
    transform: scale(0.7) translateY(-50px);  
    transition: all 0.3s ease;
}

.universal-modal.show .modal-container {
    transform: scale(1) translateY(0);
}

/* ===== MODAL SIZES ===== */

.modal-container.modal-normal {
    max-width: 500px;
}

.modal-container.modal-large {
    max-width: 800px;
}

.modal-container.modal-extra-large {
    max-width: 1200px;
    width: 95%;
}

.modal-container.modal-ai-fullscreen {
    max-width: 95vw;
    width: 95vw;
    height: 90vh;
    max-height: 90vh;
}

/* ===== MODAL HEADER ===== */

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
    background: rgba(255, 215, 0, 0.05);
}

.modal-title {
    color: #ffd700;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.modal-close {
    background: none;
    border: none;
    color: #bbb;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* ===== MODAL BODY ===== */

.modal-body {
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex: 1;
    overflow-y: auto;
    max-height: calc(80vh - 100px); /* Kivonva a header magassága */
}

.modal-icon {
    flex-shrink: 0;
    font-size: 2rem;
    line-height: 1;
}

.modal-content {
    flex: 1;
    color: #e0e0e0;
    font-size: 1rem;
    line-height: 1.6;
}

.modal-content h1,
.modal-content h2,
.modal-content h3,
.modal-content h4 {
    color: #ffd700;
    margin-top: 0;
    margin-bottom: 12px;
}

.modal-content p {
    margin-bottom: 12px;
}

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

/* ===== MODAL FOOTER ===== */

.modal-footer {
    padding: 16px 24px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid rgba(255, 215, 0, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: none;
}

.modal-btn:focus {
    outline: 2px solid rgba(255, 215, 0, 0.5);
    outline-offset: 2px;
}

/* ===== BUTTON STYLES ===== */

.btn-primary {
    background: #007bff;
    color: #fff;
}

.btn-primary:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background: #545b62;
    transform: translateY(-1px);
}

.btn-success {
    background: #28a745;
    color: #fff;
}

.btn-success:hover {
    background: #1e7e34;
    transform: translateY(-1px);
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
    transform: translateY(-1px);
}

.btn-danger {
    background: #dc3545;
    color: #fff;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-1px);
}

/* ===== MODAL TYPES ===== */

.modal-info .modal-icon {
    color: #17a2b8;
}

.modal-info .modal-container {
    border-color: rgba(23, 162, 184, 0.4);
}

.modal-warning .modal-icon {
    color: #ffc107;
}

.modal-warning .modal-container {
    border-color: rgba(255, 193, 7, 0.4);
}

.modal-error .modal-icon {
    color: #dc3545;
}

.modal-error .modal-container {
    border-color: rgba(220, 53, 69, 0.4);
}

.modal-success .modal-icon {
    color: #28a745;
}

.modal-success .modal-container {
    border-color: rgba(40, 167, 69, 0.4);
}

.modal-confirm .modal-icon {
    color: #6f42c1;
}

.modal-confirm .modal-container {
    border-color: rgba(111, 66, 193, 0.4);
}

/* ===== BODY MODAL OPEN ===== */

body.modal-open {
    overflow: hidden !important; /* Erős prioritás */
    position: fixed !important; /* Teljesen megakadályozza a scrollozást */
    width: 100% !important;
    height: 100% !important;
    top: 0 !important; /* Pozíció rözítés */
    left: 0 !important; /* Pozíció rözítés */
}

body.modal-open html {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* RAID LISTA: scroll tiltás + dinamikus magasság modal nyitáskor */
body.modal-open .raid-list-container {
    overflow: hidden !important; /* Scroll tiltás - ez a lényeg */
    max-height: none !important; /* Nincs magasság korlátozás */
    height: auto !important; /* Dinamikusan nő a tartalom szerint */
}

/* MODAL ELEMEK VÉDELME - ezek scrollozhatnak normálisan */
body.modal-open .universal-modal,
body.modal-open .modal-container,
body.modal-open .modal-content,
body.modal-open .modal-body {
    overflow: auto !important; /* Modal tartalom scrollozhat */
}

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

@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        margin: 20px;
    }
    
    .modal-header {
        padding: 16px 20px;
    }
    
    .modal-body {
        padding: 20px;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .modal-footer {
        padding: 12px 20px 16px;
        flex-direction: column;
    }
    
    .modal-btn {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .modal-btn:last-child {
        margin-bottom: 0;
    }
}

/* ===== VIDEÓ MODAL SPECIÁLIS Z-INDEX ===== */
/* AI Chat modal: 10000, Videó modal: 15000+ */
.video-modal-overlay {
    z-index: 15000 !important;
}

.universal-modal.video-modal-overlay {
    z-index: 15000 !important;
}

.universal-modal.video-modal-overlay .modal-backdrop {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(6px);
}

.universal-modal.video-modal-overlay .modal-container {
    border: 2px solid rgba(255, 107, 53, 0.5);
    box-shadow: 0 25px 80px rgba(255, 107, 53, 0.3);
}

.universal-modal.video-modal-overlay .modal-header {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
}

.universal-modal.video-modal-overlay .modal-close {
    color: white;
}

.universal-modal.video-modal-overlay .modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}