/**
 * Common Modal Styles
 * Reusable modal styling for all pages
 */

/* Modal Base Styles */
.modal-backdrop {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Modal Animation Classes */
.modal-container {
    animation: modalFadeIn 0.3s ease-out;
}

.modal-container.closing {
    animation: modalFadeOut 0.3s ease-in;
}

/* Modal Content Animation */
.modal-content {
    animation: modalScaleIn 0.3s ease-out;
}

.modal-content.closing {
    animation: modalScaleOut 0.3s ease-in;
}

/* Keyframe Animations */
@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalFadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes modalScaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes modalScaleOut {
    from {
        transform: scale(1);
        opacity: 1;
    }

    to {
        transform: scale(0.9);
        opacity: 0;
    }
}

/* Form Styling Enhancements */
.modal-form input:focus,
.modal-form select:focus,
.modal-form textarea:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.modal-form input,
.modal-form select,
.modal-form textarea {
    transition: all 0.3s ease;
}

/* Custom Select Styling */
.modal-form select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    appearance: none;
}

/* Button Hover Effects */
.modal-submit-btn {
    position: relative;
    overflow: hidden;
}

.modal-submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.modal-submit-btn:hover::before {
    left: 100%;
}

/* Success Notification */
.success-notification {
    animation: slideInRight 0.3s ease-out;
}

.success-notification.hide {
    animation: slideOutRight 0.3s ease-in;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(100%);
    }
}

/* Responsive Design */
@media (max-width: 640px) {
    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }

    .modal-header {
        padding: 1rem 1.5rem;
    }

    .modal-body {
        padding: 1.5rem;
    }
}

/* Accessibility Enhancements */
.modal-form input:focus,
.modal-form select:focus,
.modal-form textarea:focus {
    outline: 2px solid #1f2937;
    outline-offset: 2px;
}

/* Loading State */
.modal-loading {
    opacity: 0.6;
    pointer-events: none;
}

.modal-loading .modal-submit-btn {
    position: relative;
}

.modal-loading .modal-submit-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .modal-content {
        background-color: #1f2937;
        color: #f9fafb;
    }

    .modal-form input,
    .modal-form select,
    .modal-form textarea {
        background-color: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }

    .modal-form input::placeholder,
    .modal-form textarea::placeholder {
        color: #9ca3af;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .modal-content {
        border: 2px solid #000;
    }

    .modal-form input,
    .modal-form select,
    .modal-form textarea {
        border: 2px solid #000;
    }

    .modal-submit-btn {
        border: 2px solid #000;
    }
}