/* 统一模态框样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
}

.modal-container {
    background: var(--modal-bg, #ffffff);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    transform: scale(0.8) translateY(-20px);
    transition: transform 0.3s ease;
    border: 1px solid var(--modal-border, #e5e7eb);
}

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

.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--modal-border, #e5e7eb);
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.modal-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    flex-shrink: 0;
}

.modal-info .modal-icon {
    background: #dbeafe;
    color: #1d4ed8;
}

.modal-success .modal-icon {
    background: #dcfce7;
    color: #16a34a;
}

.modal-error .modal-icon {
    background: #fee2e2;
    color: #dc2626;
}

.modal-warning .modal-icon {
    background: #fef3c7;
    color: #d97706;
}

.modal-confirm .modal-icon {
    background: #f3e8ff;
    color: #9333ea;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--modal-text, #111827);
    flex: 1;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--modal-text-secondary, #6b7280);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--modal-hover-bg, #f3f4f6);
    color: var(--modal-text, #111827);
}

.modal-body {
    padding: 16px 24px 24px;
}

.modal-body p {
    margin: 0;
    color: var(--modal-text-secondary, #6b7280);
    line-height: 1.6;
    font-size: 14px;
}

.modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--modal-secondary-bg, #f3f4f6);
    color: var(--modal-text, #374151);
    border: 1px solid var(--modal-border, #d1d5db);
}

.btn-secondary:hover {
    background: var(--modal-secondary-hover, #e5e7eb);
    transform: translateY(-1px);
}

/* 暗黑模式样式 */
[data-theme="dark"] {
    --modal-bg: #1f2937;
    --modal-border: #374151;
    --modal-text: #f9fafb;
    --modal-text-secondary: #d1d5db;
    --modal-hover-bg: #374151;
    --modal-secondary-bg: #374151;
    --modal-secondary-hover: #4b5563;
}

[data-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .modal-info .modal-icon {
    background: #1e3a8a;
    color: #60a5fa;
}

[data-theme="dark"] .modal-success .modal-icon {
    background: #14532d;
    color: #4ade80;
}

[data-theme="dark"] .modal-error .modal-icon {
    background: #7f1d1d;
    color: #f87171;
}

[data-theme="dark"] .modal-warning .modal-icon {
    background: #78350f;
    color: #fbbf24;
}

[data-theme="dark"] .modal-confirm .modal-icon {
    background: #581c87;
    color: #c084fc;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .modal-container {
        width: 95%;
        margin: 20px;
    }
    
    .modal-header {
        padding: 16px 20px 12px;
    }
    
    .modal-body {
        padding: 12px 20px 20px;
    }
    
    .modal-footer {
        padding: 12px 20px 20px;
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        margin: 0;
    }
}

/* 动画效果 */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes modalSlideOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
}

.modal-overlay.show .modal-container {
    animation: modalSlideIn 0.3s ease;
}

.modal-overlay.hide .modal-container {
    animation: modalSlideOut 0.3s ease;
}