/* ===================================
   01MANA - ELEGANT MODAL SYSTEM
   =================================== */

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Modal Container */
.modal-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    max-width: 420px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-overlay.show .modal-container {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Modal Header */
.modal-header {
    padding: 24px 24px 0 24px;
    border-bottom: none;
    position: relative;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    text-align: center;
    line-height: 1.4;
}

/* Modal Body */
.modal-body {
    padding: 20px 24px;
    text-align: center;
}

.modal-message {
    font-size: 16px;
    color: #475569;
    line-height: 1.6;
    margin: 0;
    font-weight: 400;
}

/* Modal Icon */
.modal-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px auto;
    font-size: 28px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.modal-icon.success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.modal-icon.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.modal-icon.warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.modal-icon.info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

/* Modal Footer */
.modal-footer {
    padding: 0 24px 24px 24px;
    border-top: none;
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.modal-btn.primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.modal-btn.primary:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.modal-btn.secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.modal-btn.secondary:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #334155;
}

/* Modal Close Button */
.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 20px;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #f1f5f9;
    color: #64748b;
}

/* Modal Animations */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes modalSlideOut {
    from {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -60%) scale(0.9);
    }
}

.modal-container.show {
    animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.modal-container.hide {
    animation: modalSlideOut 0.2s ease forwards;
}

/* Responsive Design */
@media (max-width: 480px) {
    .modal-container {
        width: 95%;
        margin: 20px;
    }

    .modal-header {
        padding: 20px 20px 0 20px;
    }

    .modal-body {
        padding: 16px 20px;
    }

    .modal-footer {
        padding: 0 20px 20px 20px;
        flex-direction: column;
    }

    .modal-btn {
        width: 100%;
    }

    .modal-icon {
        width: 56px;
        height: 56px;
        font-size: 24px;
    }

    .modal-title {
        font-size: 16px;
    }

    .modal-message {
        font-size: 15px;
    }
}

/* Dark Mode Support */
[data-theme="dark"] .modal-container {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #334155;
}

[data-theme="dark"] .modal-title {
    color: #f1f5f9;
}

[data-theme="dark"] .modal-message {
    color: #cbd5e1;
}

[data-theme="dark"] .modal-close {
    color: #64748b;
}

[data-theme="dark"] .modal-close:hover {
    background: #334155;
    color: #94a3b8;
}

[data-theme="dark"] .modal-btn.secondary {
    background: #334155;
    color: #cbd5e1;
    border-color: #475569;
}

[data-theme="dark"] .modal-btn.secondary:hover {
    background: #475569;
    border-color: #64748b;
    color: #e2e8f0;
}

/* Accessibility */
.modal-container:focus {
    outline: none;
}

/* Loading State */
.modal-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.modal-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Toast Notifications (alternative to modals for quick messages) */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    max-width: 400px;
}

.toast-notification {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 16px 20px;
    margin-bottom: 12px;
    border-left: 4px solid;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-notification.success {
    border-left-color: #10b981;
    background: linear-gradient(135deg, #f0fdf4, #ffffff);
}

.toast-notification.error {
    border-left-color: #ef4444;
    background: linear-gradient(135deg, #fef2f2, #ffffff);
}

.toast-notification.warning {
    border-left-color: #f59e0b;
    background: linear-gradient(135deg, #fffbeb, #ffffff);
}

.toast-notification.info {
    border-left-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff, #ffffff);
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.toast-close {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #6b7280;
}