/* modal-styles.css */
.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    pointer-events: none;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 10001;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 95vw;
    max-height: 95vh;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s;
    margin: 0px;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #FFFFFF;
    z-index: 1;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.2);
    color: #333;
}

.modal-main {
    padding: 1.5rem; /* 对应 @apply p-6（1rem=16px，1.5rem=24px） */
}

.modal-loading {
    padding: 40px;
    text-align: center;
    color: #6b7280;
}

body.modal-open {
    overflow: hidden;
}

.modal-box {
    position: relative;
    width: 100%;
    max-width: 99vw;
    background-color: white;
    border-radius: 0.75rem; /* 12px */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); /* 对应 shadow-2xl */
    overflow: hidden;
}
@media (min-width: 768px) { /* 对应 md: 断点（768px） */
    .modal-box {
        max-width: 28rem; /* 对应 md:max-w-md（448px） */
    }
}

.modal-header {
    padding: 1rem; /* 对应 p-4 */
    border-bottom: 1px solid #e5e7eb; /* 对应 border-b border-gray-200 */
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f9fafb; /* 对应 bg-gray-50 */
    position: relative;
}

.form-group {
    margin-bottom: 0.5rem; /* 对应 mb-2 */
}
.form-group > * + * { /* 对应 space-y-2（子元素间距） */
    margin-top: 0.5rem;
}

.form-label {
    display: block; /* 对应 block */
    font-size: 0.875rem; /* 对应 text-sm */
    font-weight: 500; /* 对应 font-medium */
    color: #374151; /* 对应 text-gray-700 */
}

.form-input {
    width: 100%; /* 对应 w-full */
    border: 1px solid #d1d5db; /* 对应 border border-gray-300 */
    border-radius: 0.5rem; /* 对应 rounded-lg */
    padding: 0.5rem; /* 对应 p-2 */
    transition: all; /* 对应 transition-all */
}
.form-input:focus {
    outline: none;
    ring: 2px solid #3b82f6; /* 对应 focus:ring-2 focus:ring-blue-500 */
    border-color: #3b82f6; /* 对应 focus:border-blue-500 */
}

.modal-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.modal-overlay.fade-in {
    opacity: 1;
    pointer-events: auto;
}

/* 预加载容器保持隐藏 */
#modalPreloadContainer {
    display: none !important;
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 0.75rem;
}

.modal-submit {
    background-color: #2563eb;
    color: white;
    padding-left: 1rem;
    padding-right: 1rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    border-radius: 0.5rem;
    flex: 1;
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.modal-submit:hover {
    background-color: #1d4ed8;
}