/**
 * 现代化模态框组件样式
 * 替代原生的 alert(), confirm(), prompt() 弹窗
 */

/* 模态框遮罩层 */
.modal-dialog-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal-dialog-overlay.show {
    display: flex;
    opacity: 1;
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 模态框主体 */
.modal-dialog-box {
    background: #ffffff;
    border-radius: 16px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

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

/* 模态框头部 */
.modal-dialog-header {
    display: flex;
    align-items: center;
    padding: 20px 24px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: relative;
}

.modal-dialog-icon {
    font-size: 28px;
    margin-right: 12px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.modal-dialog-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    flex: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.modal-dialog-close {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.modal-dialog-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}

/* 模态框内容区 */
.modal-dialog-body {
    padding: 24px;
}

.modal-dialog-message {
    margin: 0 0 16px 0;
    font-size: 15px;
    color: #333;
    line-height: 1.6;
    word-break: break-word;
}

.modal-dialog-message:last-child {
    margin-bottom: 0;
}

/* 输入框样式 */
.modal-dialog-input-wrapper {
    margin-top: 16px;
}

.modal-dialog-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    background: #fafafa;
}

.modal-dialog-input:focus {
    border-color: #667eea;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.modal-dialog-input::placeholder {
    color: #999;
}

/* 模态框底部按钮区 */
.modal-dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px 24px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

/* 按钮基础样式 */
.modal-dialog-btn {
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
}

/* 取消按钮 */
.modal-dialog-btn-cancel {
    background: #e9ecef;
    color: #495057;
}

.modal-dialog-btn-cancel:hover {
    background: #dee2e6;
    transform: translateY(-1px);
}

/* 确认按钮 */
.modal-dialog-btn-confirm {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.modal-dialog-btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.modal-dialog-btn-confirm:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* 危险操作按钮 */
.modal-dialog-btn-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    box-shadow: 0 4px 12px rgba(238, 90, 90, 0.3);
}

.modal-dialog-btn-danger:hover {
    box-shadow: 0 6px 16px rgba(238, 90, 90, 0.4);
}

/* 成功按钮 */
.modal-dialog-btn-success {
    background: linear-gradient(135deg, #51cf66 0%, #40c057 100%);
    box-shadow: 0 4px 12px rgba(64, 192, 87, 0.3);
}

.modal-dialog-btn-success:hover {
    box-shadow: 0 6px 16px rgba(64, 192, 87, 0.4);
}

/* 响应式设计 */
@media (max-width: 480px) {
    .modal-dialog-box {
        width: 95%;
        max-width: none;
        margin: 16px;
    }
    
    .modal-dialog-header {
        padding: 16px 20px 12px;
    }
    
    .modal-dialog-icon {
        font-size: 24px;
    }
    
    .modal-dialog-title {
        font-size: 16px;
    }
    
    .modal-dialog-body {
        padding: 20px;
    }
    
    .modal-dialog-footer {
        padding: 12px 20px 20px;
        flex-direction: column-reverse;
    }
    
    .modal-dialog-btn {
        width: 100%;
        padding: 12px 24px;
    }
}

/* 暗色主题支持（可选） */
@media (prefers-color-scheme: dark) {
    .modal-dialog-box {
        background: #2d2d2d;
    }
    
    .modal-dialog-message {
        color: #e0e0e0;
    }
    
    .modal-dialog-input {
        background: #3d3d3d;
        border-color: #4d4d4d;
        color: #e0e0e0;
    }
    
    .modal-dialog-input:focus {
        background: #3d3d3d;
    }
    
    .modal-dialog-footer {
        background: #252525;
        border-top-color: #3d3d3d;
    }
    
    .modal-dialog-btn-cancel {
        background: #4d4d4d;
        color: #e0e0e0;
    }
    
    .modal-dialog-btn-cancel:hover {
        background: #5d5d5d;
    }
}
