/**
 * Shared modal overlay and container styles.
 * Used across accounts, feeds, admin panel, and competitions.
 * Toggle visibility with .show or .active on .modal-overlay.
 */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal, 1040);
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s var(--smooth, ease);
}

.modal-overlay.show,
.modal-overlay.active {
    display: flex;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-dialog,
.modal-container {
    background: var(--bg-card, #fff);
    border-radius: var(--border-radius, 12px);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl, 0 24px 60px rgba(0, 0, 0, 0.2));
    animation: modalSlideUp 0.3s var(--smooth, ease);
    border: 1px solid var(--border-color, #e5e7eb);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light, #e2e8ff);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: var(--transition-fast, all 0.15s ease);
}

.modal-close-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.modal-body p {
    margin: 0 0 0.75rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

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

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-light, #e2e8ff);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .modal-dialog,
    .modal-container {
        width: 95%;
        max-height: 85vh;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }

    .modal-footer {
        flex-direction: column-reverse;
    }
}
