/**
 * Custom Modal Component Styles for Docufisc
 * Provides consistent, accessible modal dialogs across the application
 */

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
}

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

/* Modal Container */
.modal-container {
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 500px;
    width: 100%;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease-in-out;
}

.modal-overlay.active .modal-container {
    transform: scale(1) translateY(0);
}

/* Modal Header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-title i {
    font-size: 1.375rem;
}

/* Modal Close Button */
.modal-close {
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.modal-close:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Modal Body */
.modal-body {
    padding: 1.5rem;
}

.modal-description {
    font-size: 1rem;
    line-height: 1.6;
    color: #4b5563;
    margin: 0;
    white-space: pre-line;
}

/* Modal Warning Box */
.modal-warning {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    border-radius: 0.5rem;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #92400e;
}

.modal-warning i {
    flex-shrink: 0;
}

/* Modal Footer */
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.modal-footer .btn {
    min-width: 100px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 1rem;
    }

    .modal-container {
        max-width: 100%;
        border-radius: 0.75rem;
    }

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

    .modal-title {
        font-size: 1.125rem;
    }

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

    .modal-footer .btn {
        width: 100%;
        min-width: auto;
    }
}

/* Accessibility */
body.modal-open {
    overflow: hidden;
}

/* Prevent text selection on overlay */
.modal-overlay {
    user-select: none;
    -webkit-user-select: none;
}

.modal-container {
    user-select: text;
    -webkit-user-select: text;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .modal-overlay,
    .modal-container {
        transition: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .modal-container {
        border: 2px solid #1f2937;
    }

    .modal-header {
        border-bottom-width: 2px;
    }

    .modal-footer {
        border-top-width: 2px;
    }
}

/* Dark mode support (optional, if implemented) */
@media (prefers-color-scheme: dark) {
    .modal-container {
        background: #1f2937;
    }

    .modal-header,
    .modal-footer {
        background: #111827;
        border-color: #374151;
    }

    .modal-title {
        color: #f3f4f6;
    }

    .modal-description {
        color: #d1d5db;
    }

    .modal-close {
        color: #9ca3af;
    }

    .modal-close:hover {
        background: #374151;
        color: #f3f4f6;
    }
}
