/* Custom Modal Dialog Styles */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-show {
    opacity: 1;
}

.modal-show .modal-dialog {
    transform: scale(1);
    opacity: 1;
}

.modal-hide {
    opacity: 0;
}

.modal-hide .modal-dialog {
    transform: scale(0.9);
    opacity: 0;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.modal-dialog {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid var(--border-glass);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    color: var(--accent);
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.modal-close:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-text {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
    margin: 0;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 20px 24px;
    border-top: 1px solid var(--border-glass);
}

.modal-footer .btn {
    min-width: 100px;
    padding: 12px 24px;
}

/* Form specific styles */
.modal-form .modal-field {
    margin-bottom: 20px;
}

.modal-form .modal-field:last-child {
    margin-bottom: 0;
}

.modal-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.modal-form input,
.modal-form textarea,
.modal-form select {
    width: 100%;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .modal-dialog {
        width: 95%;
        max-width: none;
        margin: 10px;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 18px;
    }

    .modal-header h3 {
        font-size: 1.1rem;
    }

    .modal-footer {
        flex-direction: column-reverse;
    }

    .modal-footer .btn {
        width: 100%;
        min-width: auto;
    }
}

/* Loading state for modal buttons */
.modal-footer .btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.modal-footer .btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: currentColor;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}