/* ========================================
   ELEIRA MODAL SYSTEM - SHARED COMPONENT
   File: /wp-content/plugins/eleira-core/assets/css/modal-system.css
   Clean modal styling compatible with plugin architecture
   ======================================== */

/* Modal Base */
.eleira-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.eleira-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

/* Modal Content Sizes */
.eleira-modal--small .eleira-modal-content {
    max-width: 400px;
}

.eleira-modal--medium .eleira-modal-content {
    max-width: 500px;
}

.eleira-modal--large .eleira-modal-content {
    max-width: 800px;
}

/* Modal Content */
.eleira-modal-content {
    position: relative;
    width: 90%;
    max-width: 500px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: eleira-modal-appear 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes eleira-modal-appear {
    from {
        transform: scale(0.7) translateY(50px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Modal Header */
.eleira-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1.5rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.eleira-modal-title {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 1.5rem;
    font-weight: 300;
    color: #2c2c2c;
    margin: 0;
    line-height: 1.2;
}

.eleira-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.eleira-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #2c2c2c;
}

.eleira-modal-close:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Modal Body */
.eleira-modal-body {
    padding: 0 1.5rem 1.5rem;
}

/* Loading State */
.eleira-modal-loading {
    pointer-events: none;
    opacity: 0.7;
}

.eleira-modal-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top: 3px solid #9f775e;
    border-radius: 50%;
    animation: eleira-modal-spin 1s linear infinite;
}

@keyframes eleira-modal-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal Messages */
.eleira-modal-message {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    font-size: 0.875rem;
    line-height: 1.4;
    text-align: center;
    animation: eleira-message-slide-in 0.3s ease;
}

@keyframes eleira-message-slide-in {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.eleira-modal-message--success {
    background: rgba(72, 187, 120, 0.15);
    border: 1px solid rgba(72, 187, 120, 0.3);
    color: #2d7738;
}

.eleira-modal-message--error {
    background: rgba(245, 101, 101, 0.15);
    border: 1px solid rgba(245, 101, 101, 0.3);
    color: #c53030;
}

.eleira-modal-message--info {
    background: rgba(66, 153, 225, 0.15);
    border: 1px solid rgba(66, 153, 225, 0.3);
    color: #2c5aa0;
}

/* Body Lock */
body.eleira-modal-open {
    overflow: hidden;
}

/* Focus Management */
.eleira-modal [tabindex="-1"]:focus {
    outline: none !important;
}

/* High Contrast Support */
@media (prefers-contrast: high) {
    .eleira-modal-overlay {
        background: rgba(0, 0, 0, 0.9);
    }
    
    .eleira-modal-content {
        border: 2px solid #000;
    }
    
    .eleira-modal-close {
        border: 1px solid #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .eleira-modal-content {
        animation: none;
    }
    
    .eleira-modal-message {
        animation: none;
    }
    
    .eleira-modal-close {
        transition: none;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .eleira-modal-content {
        width: 95%;
        margin: 1rem;
        max-height: 85vh;
    }
    
    .eleira-modal-header {
        padding: 1rem 1rem 0;
        margin-bottom: 1rem;
    }
    
    .eleira-modal-body {
        padding: 0 1rem 1rem;
    }
    
    .eleira-modal-title {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .eleira-modal-content {
        width: 98%;
        margin: 0.5rem;
    }
    
    .eleira-modal-header {
        padding: 0.75rem 0.75rem 0;
        margin-bottom: 0.75rem;
    }
    
    .eleira-modal-body {
        padding: 0 0.75rem 0.75rem;
    }
    
    .eleira-modal-title {
        font-size: 1.125rem;
    }
}

/* Print Styles */
@media print {
    .eleira-modal {
        display: none !important;
    }
}