/**
 * 正百翔·智选 自定义弹窗样式
 * 替代原生 alert() 和 confirm()
 */

/* 遮罩层 */
.custom-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

/* 弹窗容器 */
.custom-dialog {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    min-width: 320px;
    max-width: 90%;
    animation: slideIn 0.3s ease;
}

/* 弹窗头部 */
.custom-dialog-header {
    padding: 20px 24px 0;
    text-align: center;
}

.custom-dialog-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.custom-dialog-icon.success { color: #28a745; }
.custom-dialog-icon.error { color: #dc3545; }
.custom-dialog-icon.warning { color: #ffc107; }
.custom-dialog-icon.info { color: #17a2b8; }
.custom-dialog-icon.confirm { color: #667eea; }

/* 弹窗内容 */
.custom-dialog-body {
    padding: 16px 24px;
    text-align: center;
}

.custom-dialog-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.custom-dialog-message {
    font-size: 15px;
    color: #666;
    line-height: 1.6;
}

/* 弹窗底部按钮 */
.custom-dialog-footer {
    padding: 16px 24px 20px;
    display: flex;
    justify-content: center;
    gap: 12px;
}

.custom-dialog-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 80px;
}

.custom-dialog-btn:hover {
    transform: translateY(-1px);
}

.custom-dialog-btn:active {
    transform: translateY(0);
}

/* 确认按钮 */
.custom-dialog-btn-primary {
    background: #667eea;
    color: #fff;
}

.custom-dialog-btn-primary:hover {
    background: #5a6fd6;
}

/* 取消按钮 */
.custom-dialog-btn-secondary {
    background: #f0f0f0;
    color: #666;
}

.custom-dialog-btn-secondary:hover {
    background: #e0e0e0;
}

/* 危险按钮 */
.custom-dialog-btn-danger {
    background: #dc3545;
    color: #fff;
}

.custom-dialog-btn-danger:hover {
    background: #c82333;
}

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* 关闭动画 */
.custom-dialog-overlay.closing {
    animation: fadeOut 0.2s ease forwards;
}

.custom-dialog-overlay.closing .custom-dialog {
    animation: slideOut 0.2s ease forwards;
}

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

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

/* 移动端适配 */
@media (max-width: 480px) {
    .custom-dialog {
        min-width: 280px;
        margin: 20px;
    }

    .custom-dialog-header {
        padding: 16px 20px 0;
    }

    .custom-dialog-body {
        padding: 12px 20px;
    }

    .custom-dialog-footer {
        padding: 12px 20px 16px;
    }

    .custom-dialog-btn {
        padding: 12px 20px;
        flex: 1;
    }
}
